This topic contains 4 replies, has 0 voices, and was last updated by chanarbon 7 years, 10 months ago.

  • Author
    Posts
  • #1395

    OKolesnyk

    Hello guys,

    Please advice, how in SuiteScript 2.0 we can work with timezones. In 1.0 was few timezone functions, in 2.0 nothing similar.

    I try to set created date custom field for INVENTORY_NUMBER record.

    So I can’t find no way to get my current time for my timezone. If we use new Date() – it returns server time.

    ‘N/format’ also not include any transformation API.

    So I can’t get current user timezone and transform “new Date()”.

    Thank you
    This is a cached copy. Click here to see the original post.

  • #1396

    CREECE

    I believe you can use [Nruntime] and use runtime.getCurrentUser().getPreference(‘TIMEZONE’)

  • #1397

    chanarbon

    Hi @Okolesnyk,

    If you are working with server side script for this concern, you may try N/config to load the user preferences as well. Also for the timezone conversation, N/format has a timezone parameter which you can try on your end. Please see this SuiteAnswers article for more info on the usage https://netsuite.custhelp.com/app/an…ail/a_id/61223 and https://netsuite.custhelp.com/app/an…ail/a_id/61222

  • #1398

    ArunKumar

    Hello everyone,

    I’m trying to display the PDF content in suite script 2.0 But I’m not successful and I’m able to do it in suite script 1.0.Please see the below code and suggest me what I’m missing here.

    1.0 Sample code to display PDF on suite let page-Working)

    var xmlStr = ‘nnnnHello World!nn’;;

    var file = nlapiXMLToPDF( xmlStr );

    response.setContentType(‘PDF’,’Test’ + ‘.pdf’, ‘inline’);

    response.write( file.getValue() );

    2.0 Sample code to display PDF on suite let page-not working):

    var xmlStr = ‘nnnnHello World!nn’;;

    var pdfFile = render.xmlToPdf({

    xmlString: xmlStr

    });

    resObj = pdfFile.getContents();

    context.response.write(resObj);

    Thanks,

    โ€‹Arun.

  • #1399

    chanarbon

    Hi ArunKumar

    One thing that you missed in here is the setting of the content type for the response. Also I would suggest that you the concern that you have would be referred using a new post here in the UG.

You must be logged in to reply to this topic.