CRMScript. Dates in quote documents does not format correctly.

lock
push_pin
done
Besvarat
0

Hey, 

I am trying to generate quote/order confirmation documents using CRMScript. I just can't seem to format the dates correctly.

A code snippet of the document generation:

NSQuotePublishDocuments saveQuoteDocs(Integer quoteVersionId, Bool isOrderConfirmation){

  NSQuoteAgent qa;

  DateTime timeNow = getCurrentDateTime();

  DateTime expiryDate = getCurrentDateTime().addDay(expiryDateDays);
  DateTime followupDate = getCurrentDateTime().addDay(followUpDateDays);
  followupDate.addHour(followUpDateHours);

  NSQuoteEntity qEntity = qa.GetQuoteEntityFromSaleId(ed.getInputValue("ActiveSaleId").toInteger());

  qEntity.SetPreferredEmailCulture(quoteCulture);

  qa.SaveQuoteEntity(qEntity);

  NSQuotePublishDocuments docs;

  if(isOrderConfirmation) {
    docs = qa.GenerateQuoteDocuments(quoteVersionId, orderTemplateEmailId, true, getOrderDocTmplId(), true, orderSubjectTextEmail);
  } else {
    qa.SendQuoteVersion(quoteVersionId, expiryDate, followupDate, followUpText, quoteCulture);
    docs = qa.GenerateQuoteDocuments(quoteVersionId, quoteTemplateEmailId, true, getQuoteDocTmplId(), true, quoteSubjectTextEmail);
  }

  return docs;

}

If saveQuoteDocs should generate an orderconfirmation, the following line has also been executed:

qAgent.PlaceOrder(qAlternative.GetQuoteAlternativeId(), markAsSold, poNum, orderComment, culture);

The code generates a document and substitutes all of the template variables like it should, except for the dates.

No matter what i try, dates remain on the MM/dd/yyyy format. I need it to be on a danish format (dd-MM-yyyy). 

I have tried passing both "da", "DA", "da-DK", "DK", "dk" and "" as the culture argument to the PlaceOrder and SendQuoteVersion functions. I have tried adding the mergefield "Culture:da-DK" to the template itself as well. I noticed during testing, that the mergefield "Culture:" actually succeded in changing the format of numbers like the salesprice of a quoteline (e.g "Culture:en-US" = 1,234.20 ... "Culture:da-DK" = 1.234,20) , yet dates like {sdat}, {sada} remain unchanged. 

If i use the normal quote dialog option of "show confirmation" through the ui to generate the document, everything works correctly.

 

I might very well have overlooked something obvious, and if so... Please enlighten me! I am running out of ideas. Help is very much appreciated :D

1 h, 39 m sedan | 08:48 fm

Allt Svar (0)

Lägg till svar