how to access the sys_id of sys_relationship from within a defined relationship script?

mrswann
Kilo Guru

I am building custom relationships and with that custom Edit buttons, (for good reason I wont go into now, you will have to trust me!)

So the Relationships themselves are filtering on a Type value, and there is a single UI Action which is displayed on each Related List which is switched to handle Type value.

This mapping between sys_relationship and type is consistent so I want to define it in a single place, and avoid hard coding sys_id into UI Action and relationships

The UI Action can get the sysparm_collection_relationship value from action.getGlideURI() - bingo!

The "Query With" field is used to build a query against current for the records to display in the list, and parent is the record on which the related list is displayed!

HOW can I get the same value from within the Relationship itself?

5 REPLIES 5

Kalaiarasan Pus
Giga Sage

I am not sure if I understand the question but if you are asking about getting the sys id of the parent record in the relationship, then parent.sys_id will give you that.


Thanks for reply,. sorry for lack of clarity.



I am asking how to access the sys_id of the relationship itself! (sys_relationship.sys_id)


RP object has some methods if I remember correctly that can be used to identify the type of the list and other such behavior. Maybe you can search using that and see if that has any method that can return you the information required.


Thanks I have looked at these, and the most likely candidates getRelatedList() and relatedList do not seem to return anything meaningful 😕