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.

Copy fields from Interaction record to Related Task

Rodrigo24
Tera Guru

Hello everyone,

I need to know how to copy fields from an Interaction to any related Record created with the "New" button of Related Record in the interaction record.
I don't know what type of / BR / UI script action I need to use.
There is a UI action that allows me to create a related incident and copy these fields, but it doesn't work using the "New" button in related task.
This UI action is:

    Name: "Create Incident"
    Condition: new GlideRecord ("incident"). CanCreate ()
    Script:
            if (current.update ()) {
                var inc = new GlideRecord ("incident");
                inc.initialize ();
                inc.caller_id = current.opened_for;
                inc.short_description = current.short_description;
                action.openGlideRecord (inc);
            }
            
            
I need something like this but working with the Related Task button or its Interceptor.

 

Any idea?

Thanks in advance.
Rodrigo.

 

1 ACCEPTED SOLUTION

Rodrigo24
Tera Guru

Hi,

 

Finally I found a solution.
I had created a new BR.

"

    var Inter = new GlideRecord('interaction');
    Inter.addQuery('sys_id', current.parent_interaction);
    Inter.query();

    if (Inter.next()) {
        current.requested_for = Inter.opened_for;
    }

"

 

Thanks.

Rodrigo.

View solution in original post

2 REPLIES 2

Cuong Phan
Kilo Sage

Hi Rodrigo,

 

You can refer to this article, passing variable from interaction any type of record

https://community.servicenow.com/community?id=community_question&sys_id=503b2dd4db628850f7fca851ca96...

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

 

Cuong Phan

DXC Consultant.

Regards,
Cuong Phan
ServiceNow Technical Lead

Rodrigo24
Tera Guru

Hi,

 

Finally I found a solution.
I had created a new BR.

"

    var Inter = new GlideRecord('interaction');
    Inter.addQuery('sys_id', current.parent_interaction);
    Inter.query();

    if (Inter.next()) {
        current.requested_for = Inter.opened_for;
    }

"

 

Thanks.

Rodrigo.