Adding more than one macro to a reference field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2015 01:15 AM
Hi All,
i want to implement a requirement to show the incidents and requests created by the selected caller in the "Caller" reference field. For that i have created two Ui macro to show the incidents & requets(one is for incident and another is for requests). if adding only one macro it is showing the records correctly. when i have added one more macro to that field only one macro is visible.I have used the below syntax to add macros 'ref_contributions=show_ci_incidents;macro_2;macro_3′. in the dictionary attribute
One more question i have whenever i am adding the ui macro one semi colon is appending be fore the icon. Can anyone please help me to acheive my requirement.
the scrren shot if i add only one ui macro is the screen shot if i add two ui macros ref_contributions=macro1;macro2
Thanks & regards,
swamy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2015 05:10 AM
Thanks for your replies! We do have different icons beside the user reference field, but what seems to be happening is the order of the "Attributes" seem to define which macro is used:
Both "Show_My_NONs" & "Show_My_Incidents" are UI Macros (the NONs was created from the Incidents and the table was changed) and depending on the one that is listed last (reading from left to right) is the one that is used. If I click on either of the two icons (the glasses coorespond to Show_My_NONs and the question mark corresponds to Show_My_Incidents) only the results of the Show_My_Incidents will display but if I change the order of the Attributes on the Dictionary to have Show_My_Incidents listed 1st and Show_My_NONs listed after it, clicking on either of the two icons will display a list of the NON tickets. (which is short for Non Catalog Requests)
OH!!! I think I've figured it out...As I indicated, I copied the code and didn't realize that the function name in each UI Macro needed to be unique! I didn't change the function call or the function name...I just left it as: onclick="showRelatedList('${ref}'); " and this seems to behave much like the "Action name" field on a UI Action...it seems to pick the function name of the one listed last in the Attributes field if they are the same. Gosh, I've spent an entire day trying to understand why only 1 UI Macro would work...I even thought I was going to see if putting "javascript:getCorrectMacro" in the Attributes field would make it work, but all that was needed was to insure that the onclick Function is unique.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2018 05:50 AM
Thanks. We had the same issue and thanks to this post, we know the function within the UI Macro should have a different name.
Principal Platform Architect, Customer Success, ServiceNow