Copy field values from SCTASK to NEW SCTASK created by clicking the NEW button from Catalog Task releated list on RITM record.

Mike Cory
Tera Contributor

Requirement:
When clicking the NEW button from Catalog Task related list on RITM...... 

  1. Copy the Short Description and Description field values from the current "active" Catalog Task to the NEW Catalog Task created after clicking the NEW button
  2. Make the Assignment Group field mandatory on the NEW Catalog Task record.

I created a an After BR (Insert,Update) on the Catalog Task table for the copy, but it's not working.  Appreciate any help.

find_real_file.png

1 ACCEPTED SOLUTION

Hi @Mike Cory,

You need to write a Display Business Rule and an Onload Client script to achieve your requirement.

Display Business Rule

Table:-SCTASK

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

    g_scratchpad.shortdescription = current.request_item.cat_item.getDisplayValue();
    gs.addInfoMessage("Item name:" + g_scratchpad.shortdescription); //comment this line once testing is done
})(current, previous);

OnLoad Client Script

function onLoad() {
   
    if (!g_form.getValue('short_description') && g_form.isNewRecord()) {
        g_form.setValue('short_description', g_scratchpad.shortdescription);
        g_form.setMandatory('assignment_group', true);
    }
}

Please mark my answer correct and helpful if this resolves your issue.

 

View solution in original post

10 REPLIES 10

Palak Gupta
Tera Guru
Tera Guru

Hi there!

In image it is visible that you are using "sc_task" table at both the places i.e. in table and in script.

Please use sc_req_item table in GlideRecord and script acordingly.

Regards,

Palak

Palak Gupta
Tera Guru
Tera Guru

Hi there!

It seems that line #4 in code is creating issue as you are comparing RITM number with SCTASK number.

modify that line and it will work.

Regards,

Palak

Mike Cory
Tera Contributor

HI Palak,

Could you elaborate on what change is required to line #4 to make it work.  

Thanks,

Hi Mike,

I have 1 more question about this, what happens if there are more than 1 sctask in related list then how you would decide which sctask short description should populate in new sctask?