Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

current record is not getting updated using the Workflow Run script.

Yesh
Tera Contributor

Hi Team,

I am trying to update the current record in the workflow run script. When I am trying to use current.update(), workflow giving a warning. So i have removed that line and simple set the value for a field. But the value of the field is not getting update even after the workflow is completed. 

Is there any other way to update the current record in workflow? I have tried using "Set Value" activity also, it is not updating the record.

Any suggestions are helpful.

Thanks

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Yesh 

Did you try updating the u_status as 4 from background script for that record just for testing?

any before update BR is blocking the update?

try this in workflow run script

current.setWorkflow(false);

current.u_status = '4';

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

14 REPLIES 14

Hi @Snehangshu Sarkar  ,

I am using the below script:

current.u_status = '4';

 

Thanks

Hi @Yesh ,

 

Try the below line.

current.setValue('u_status','4');

 

Regards,

Snehangshu Sarkar

Please mark my answer as correct if it resolves your query.

Hi @Snehangshu Sarkar ,

I have tried the script you have mentioned. Not even Updating the field.

current.setValue('u_status','4');

Thanks

Ankur Bawiskar
Tera Patron
Tera Patron

@Yesh 

Did you try updating the u_status as 4 from background script for that record just for testing?

any before update BR is blocking the update?

try this in workflow run script

current.setWorkflow(false);

current.u_status = '4';

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar ,

I have tested updating the record using Background script, It is getting updated through it. 

And I have tried the run script you have given, it is getting updated. The issue is solved.

Thanks