How to update a record after its created via flow

Prasun Sarkar7
Tera Expert

I have a requirement to update the domain and account based on the contact if the record is created via inbound flow and no i cannot use flow designer update record to update the account and domain 

this is a script wriiten with after insert br all info msg are coming but record not updating

var smb_details = current.internal_user;
    var dataQuery = new GlideRecord("table name");
    dataQuery.addQuery("shared_mailbox_name", smb_details);
    dataQuery.query();
    gs.addInfoMessage("s::"+current.internal_user);
    if (dataQuery.next()) {
        gs.addInfoMessage("ts::"+current.contact.company);
        if (dataQuery.shared_by_multiple_clients == true) {
           
            current.account=current.contact.company;
            current.sys_domain=current.contact.sys_domain;
            gs.addInfoMessage("test");
           
        }
    }
but when i change to before insert update and update manually its working
Thanks in advance
4 REPLIES 4

yashkamde
Tera Sage

Hello @Prasun Sarkar7 ,

use current.update(); -> below [current.sys_domain=current.contact.sys_domain]

In after insert BR only..

 

If my response helped mark as helpful and accept the solution.

Tanushree Maiti
Tera Patron

If you use current.update() , it will work. But I am sure you know that servicenow recommendation is not to use  current.update().

Never use current.update in a Business Rule - ServiceNow Community

So try to put it in before insert update if your requirement supports.

ok

Please mark this response as Helpful and hit Like if it assisted you with your question.