Reference Qualifier not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 01:15 PM
Hi
1. I wanted to pass company value dynamically based on value selected in problem from
2. I have created a M2M and add to related list
Once click on Edit button its showing all values which is part of cmdb_ci_nw_site table
But we need to pass the company value here dynamically from step 1 ( company is nothing but account name ) and under one account name multiple sites are there. Example here I will only able to see if it passes dynamically only like below
How to do that , manually selection of company from Company filter is not acceptable. Any idea how to pass this Dynamically from Problem from to this area based on selected value in the problem from account.
Luso
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 06:43 PM
Hi @Lusifer1984
You can achieve this using a custom UI Action. Create an UI Action of type list banner (name it as "Edit 1" like that, to differentiate it from the global Edit UI Action) for the table in related list and then in the condition use the following filter
(new GlideRecord(current.getTableName())).canCreate() && RP.isRelatedList() && !RP.getListControl().isOmitEditButton()
Then in the scrip field use the following code,
var uri = action.getGlideURI();
var path = uri.getFileFromPath();
uri.set('sysparm_m2m_ref', current.getTableName());
uri.set('sysparm_stack', 'no');
//Create query
var query = uri.get('sysparm_query');
if (query){
query = query + '^';
}else{
query = query + "company=" + parent.account_name.toString(); // Here change the company and account_name field names as per your related list table field name and parent table name
}
uri.set('sysparm_query', query);
action.setRedirectURL(uri.toString('sys_m2m_template.do'));
Now reload the form and try the Edit 1 button in your related list if it works disable the global Edit button and rename the Edit 1 button to Edit.
Please mark my answer helpful and accept as solution if it helped you 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 11:12 AM
Hi Avinash,
This is not working unfortunately
Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 11:50 AM
@Lusifer1984 try this code.
var uri = action.getGlideURI();
var path = uri.getFileFromPath();
uri.set('sysparm_m2m_ref', current.getTableName());
uri.set('sysparm_stack', 'no');
//Create query
var query = uri.get('sysparm_query');
if (query){
query = query + "^company=" + parent.u_account_name.toString(); // Here change the company and account_name field names as per your related list table field name and parent table name
}else{
query = "company=" + parent.u_account_name.toString(); // Here change the company and account_name field names as per your related list table field name and parent table name
}
uri.set('sysparm_query', query);
action.setRedirectURL(uri.toString('sys_m2m_template.do'));
Please try this code and let me know.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 12:47 PM
No Still same is coming.