The CreatorCon Call for Content is officially open! Get started here.

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

Mohit Kaushik
Mega Sage
Mega Sage

Hi Yesh,

Can you share your run script here, so that we can look into it and find out the issue.

 

Thanks,
Mohit Kaushik
Community Rising Star 2022

 

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Hi @Mohit Kaushik ,

I am using the below script:

current.u_status = '4';

 

Thanks

Have you checked the backend name and value of status fields are they correct?

And if status field is an integer type then please try current.u_status = 4;

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Yeah. I have checked the backend and it is correct. Status is the choice field. The value of the choice is 4. That is the reason i have given it as a string.

Thanks

Snehangshu Sark
Mega Guru

Hi @Yesh 

 

It might be a data type issue. Can you share your script? 

Check the field type and your value.

 

Regards,

Snehangshu Sarkar

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