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

How to get previous value when form is submitted from UI action

Chaitanya13
ServiceNow Employee
ServiceNow Employee

Hi All,

I am trying to get the previous value from the form when the form is submitted from UI action using 

current.submit();

 Now the BR is calling but getting current previous values as same.

 

Can someone help on this please.

 

Thanks.

6 REPLIES 6

Harish Vaibhare
Kilo Guru

Hi Chaitanya,

use:

1) current.update();

   

2) after insert and update business rule.

 

try this it may work.

 

Kindly Mark Helpful and Correct if it works and fulfill your requirement.

 

Thanks.

 

 

Chaitanya13
ServiceNow Employee
ServiceNow Employee

@Harish Vaibhare  I am using the same . Still i am getting previous and current values are same

you can check with below code in business rule.

 

var count =0;
    
  for(var field in current)
  {    
     if (current[field] != previous[field] )
     {
                 count++;
     }    
        
   }
    gs.addInfoMessage("count= " + count);

 

it will give you how many fields have been updated.

 

 

Dhananjay Pawar
Kilo Sage

Hi,

current.update in BR is not a good practice it takes you in infinite loop.

If you are using current.update then also use setWorkflow as false then you will get values.

 

Thanks,

Dhananjay.