UI action on Table A to insert on Table B

eromlige
Tera Contributor

I have a scoped app. I have Table A (Project) and it has a scripted (Relationship) Related List that is a list of projects associated with the parent project.

 

I've created a UI action to allow the user to insert new associations to Table B (Associated Projects). The UI Action opens a modal that is for Table B, but on submit, it creates a new Table A (Project) entry. This is not what I want. It should create a new Table B (Associated Projects) entry.

 

What's going on here? What am I missing?

 

UI Action:

 

Name: Edit Associations

Table: Project[x_somescope_project]

Action name: edit_associations

x | Active

x | Show insert

x | Show update

x | Client

x | List v2 Compatible

x | List banner button

Onclick: openProjectM2M()

Condition: parent.isValidRecord()

 

Script

function openProjectM2M() {
    var targetTable = 'x_scope_m2m_projects'; 
    var gdw = new GlideModal('glide_list_collect'); //??
     // var gdw = new GlideModal('x_scope_m2m_projects');
    gdw.setTitle('Add Associated Projects');
    gdw.setPreference('title', 'Project Selection');
    gdw.setPreference('table', targetTable);
    gdw.setPreference('query', 'active=true');
    gdw.render();
}

 

ver. Yokohama

 

 

1 REPLY 1

Fabian Kunzke
Mega Sage

Heyhey,

 

The modal you are opening is referencing a UI page. As you've commented //?? i am assuming you are not 100% on what that means. So let me guide you to the likely solution.

 

A GlideModal opens a UI page of your choice. In the code you've provided this is "glide_list_collect". This is the name of the UI page the modal opens. Within this ui page definition it is likely that you have indeed a serverside script responsible for creating the final record. You can check there, which table is used to create the final record.

 

My guess is, that this ui page does not use the correct table in the server script.

 

Hope this helps.

Regards

Fabian