OOTB ui action not creating new record on m2m

RandiReyna
Tera Contributor

Hello all,

 

 When I go to an engagement record in Audit Management and navigate to the related list. On the 'other issues' tab, when I try to create a new record from the 'New' UI action in the classic ui, the record is not being submitted and I receive a message that says 'Invalid Insert'. Should I open a case for this? This is also a client requirement but I am having no luck in getting it to work on classic ui. Any help is appreciated.

1 ACCEPTED SOLUTION

Hema P
Tera Guru

@RandiReyna OOTB Other Issues related list is not M2M table it is directly related to Issues(sn_grc_issue) table.

Hema44_0-1729005772816.png

 

New record screenshot you have shared that is also seems like different from what I see in OOTB.

 

OOTB Script of New UI Action button of Other Issues related list in Engagement.

 

var uri = action.getGlideURI();
var path = uri.getFileFromPath() + '';
path = path.substring(0, path.length - 5) + '.do';
uri.set('sys_id', '-1');

var query = new sn_grc.GRCUtils().generateNewIssue(parent, action);
uri.set('sysparm_query',query);

path = new sn_grc.GRCURIUtils().checkWizard(uri, path);
if (path)
    action.setRedirectURL(uri.toString(path));

action.setNoPop(true);

View solution in original post

4 REPLIES 4

Hema P
Tera Guru

Hi @RandiReyna,

 

From the given screenshots in your question, I could see the UI Action called "Test New" on Other Issues related list seems like custom UI Action not the OOTB (FYI - I have attached how OOTB New UI Action and what record will be opened after we click New button).
Could you please provide the more details of UI Action (like code and other fields information) if it is custom one? 

Hema44_0-1728978692346.pngHema44_1-1728978723927.png

 

 

Hi @Hema P , Yes I changed the name of the ui action to make sure I was on the right one. But I'm not able to get the form to load and submit. Could you possibly send a screenshot of the script in the ui you are seeing? Thank you!

@Hema P, this is the code in the ui action

 

var uri = action.getGlideURI();
var path = uri.getFileFromPath() + '';
path = path.substring(0, path.length - 5) + '.do';

uri.set('sys_id', '-1');

path = checkWizard(uri, path);

if (path)
action.setRedirectURL(uri.toString(path));

action.setNoPop(true);

function checkWizard(uri, path) {
var already = uri.get('WIZARD:action');
if (already == 'follow')
return null;
 
var wizID = new GlideappWizardIntercept(path).get();
if (!wizID)
return path;
 
uri.set('sysparm_parent', wizID);
uri.deleteParmameter('sysparm_referring_url');
uri.deleteMatchingParameter('sysparm_list_');
uri.deleteMatchingParameter('sysparm_record_');
uri.deleteParmameter('sys_is_list');
uri.deleteParmameter('sys_is_related_list');
uri.deleteParmameter('sys_submitted');
uri.deleteParmameter('sysparm_checked_items');
uri.deleteParmameter('sysparm_ref_list_query');
uri.deleteParmameter('sysparm_current_row');
 
uri.set('sysparm_referring_url', uri.toString());
uri.deleteMatchingParameter('fancy.');
uri.deleteMatchingParameter('sys_rownum');
uri.deleteMatchingParameter('sysparm_encoded');
uri.deleteMatchingParameter('sysparm_query_encoded');
uri.deleteParmameter('sysparm_refer');

return 'wizard_view.do';
}

Hema P
Tera Guru

@RandiReyna OOTB Other Issues related list is not M2M table it is directly related to Issues(sn_grc_issue) table.

Hema44_0-1729005772816.png

 

New record screenshot you have shared that is also seems like different from what I see in OOTB.

 

OOTB Script of New UI Action button of Other Issues related list in Engagement.

 

var uri = action.getGlideURI();
var path = uri.getFileFromPath() + '';
path = path.substring(0, path.length - 5) + '.do';
uri.set('sys_id', '-1');

var query = new sn_grc.GRCUtils().generateNewIssue(parent, action);
uri.set('sysparm_query',query);

path = new sn_grc.GRCURIUtils().checkWizard(uri, path);
if (path)
    action.setRedirectURL(uri.toString(path));

action.setNoPop(true);