Company field is not auto populating in the SCTASK record of RITM

Amith P
Kilo Contributor

The Company field is not inheriting/auto-populating in the SCTASK record even though the field is present in the RITM.

User raises the request and RITM gets created in which the company will get added automatically based on the user.

I have added the same Company field to the task which got created from the RITM. But the value is not getting captured automatically in the 'Company' in SCTASK.

RITM:

find_real_file.png

 

 

SCTASK:

find_real_file.png

1 ACCEPTED SOLUTION

Hi Amith,

the field is newly created on sc_task or sc_req_item table?

if yes on RITM and if it is populated on RITM level during catalog item submission then it should be visible on task form if you are adding it from dot walk

if above field is newly created on sc_task then you need to set it via script

have before insert business rule on sc_task and have following script

var item = new GlideRecord('sc_req_item');
item.addQuery('sys_id', current.request_item);
item.query();

if(item.next())
current.company = current.request_item.company;

// pick the company to be populated on sc_task from sc_req_item

// current.item is not valid since sc_task doesn't have that field
}

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

View solution in original post

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Amith,

Is that field a dot walked field on the form of catalog task from RITM?

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hi Ankur,

The field 'Company' is the user's company which is getting populated automatically in the RITM once the request got raised. And the same 'Company' field i added to the SCTASK as well in the Form Layout which can say as dot walked field.

Hi Amith,

Have you created company field as new one on RITM table?

Or is it dot walked field from opened_by user?

Regards

Ankur

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

Hi Ankur,

Created as a new one only.

I tried using a business rule 'after' condition in sc_task table:

(function executeRule(current, previous /*null when async*/) {

    var item = new GlideRecord('sc_req_item');
    item.addQuery('sys_id', current.request_item);
    item.query();

    if(item.next())
        current.company = current.item.company;
        }
)(current, previous);

 

But not working.