We implemented a ServiceNow SDIM in our sandbox environment and I am trying to add new custom attributes into ticket creation configuration such as “Effectivedate”. That field is defined in ServiceNow side already and when I feed this field with a static value as you can see from the screenshot, it perfectly works as expected. However, when I feed this field dynamically as following: “$!plan.arguments.effectivedate” then the ticket is being created with empty effectivedate field.
When I check the integration guide, it says I need to use a velocity template for a dynamic field. Only there is no example for this. I would like to get the current date (in the following format: “dd-MM-yyyy”) for the custom attribute that I want to add. Is there anyone has an example of this? Thanks in advance!
I used the following velocity expression for effectivedate :“effectivedate”: “#set($dateTool = $tools.date) #set($currentDate = $dateTool.format(‘dd-MM-yyyy’, $dateTool.date())) $currentDate”
Hi @sahincelik ,
Can you try modifying the Velocity expression to below and let me know if that works. As I believe you can directly use the ‘$dateTool.format()’ method without storing it in a variable.
Yes, there is a change. My point was, instead using the entire template here: “effectivedate”: “#set($dateTool = $tools.date) #set($currentDate = $dateTool.format(‘dd-MM-yyyy’, $dateTool.date())) $currentDate”, I just sent: $currentDate and it worked.