How to generate unique one time 4 digit number in workflow and send by Notification to user

vinitaraico
Tera Contributor

Hi Team,

 

I have to integrate IVM vending machine to ServiceNow ,In the workflow Once Task generated and assigned to ServiceDesk .4 digit random number(pin) send to the IVM team via   API also  PIN information with will be sent to user via email from ServiceNow ,The PIN should we valid for half n hour , pin user used to pick any item from IVM,I am stuck How i can generate PIN in workflow also How to pass it in the Notification.

 

Each request has a unique one-time-use collection code, sent securely on users email

 

1 REPLY 1

Amit Verma
Kilo Patron
Kilo Patron

Hi @vinitaraico

 

You can make use of below line of code in a Script step inside your workflow :

 

workflow.scratchpad.ivmPin = Math.floor((Math.random() * 9000) + 1).toFixed(0);

 

 

Use this workflow variable in your notification as well to send it to the users.

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.