Is there any keyword to set the Relationship Attribute at Context Level.
AnsweredHi Team,
Requirements: We have an Relationship from article (owned) to category (whereused).
Relationship Attribute: thgOxidIDrelaattr
In Article, thgOxidID attribute is mapped at Context level.
In Category, thgcategoryid attribute is mapped at Context Level.
Relationship is maintained at context level.
In Article Entities when user add a category relationship at "DE- profilze24.de" Channel Level, then we want to fetch the thgcategoryid from category at a "DE- profilze24.de" Channel Level and copied to relationship attribute....
For Example
Scenario : One Article is Linked to multiple Category
Article1 in "DE- profilze24.de" Channel with oxid=78 -> Category1 in "DE- profilze24.de" Channel with Oxid =321 RelationshipAttr Oxid = 321
Article1 in "DE- profilze24.de" Channel with oxid=78 -> Category2 in "DE- profilze24.de" Channel with Oxid = 456 RelationshipAttr Oxid = 456
We have written an BR which will give me the value like 321 or 456...but we are unable to set the relationshipattribute at context level because not sure which is the correct keyword to use in this scenatio...For now i have used SetRelationshipAttribute keyword but not working as excepted.
varcategoryoxidvalue:="";
varcurrentcontext:=GetContextPath["channel"];
varconcat:=Concat["channel:",varcurrentcontext];
varentityids:=GetRelatedEntityIdsForContext["belongstowebclassification","category",varconcat];
IIF[IsNullOrEmpty[varentityids]=false,ITERATE[varentityids,'(SetVariable["varcategoryoxidvalue", GetEntityAttributeValueByIdInContext["_DEFAULT","_DEFAULT",ITERATIONITEM,"category","thgtpcategoryid",varconcat]] AND SetRelationshipAttribute["_DEFAULT","_DEFAULT",ITERATIONITEM,"belongstowebclassification","item","thgtpoxidIDrelattr",varcategoryoxidvalue])'] ,false] AND
SetAttributeValue["_DEFAULT","_DEFAULT","dummycategoryoxifvalue",varcategoryoxidvalue]
If any one has any other solution please suggest.
-
Hello Kajal
Yes, you can use SetRelationshipAttribute.
https://docx.syndigo.com/docs/setrelationshipattribute
This keyword will set the attribute value for the relationship for the context in which the BR was triggered - so, if you have an update in the self context level, you will first need to send a signal to the context in which the update is to be done - we normally update a trigger attribute (for example thgTriggerRelAttrUpdate) and use the Now[] keyword to set a timestamp (just make sure that your trigger BR runs in ComputationPostProcess or ValidationPostProcess).
1
Please sign in to leave a comment.
Comments
1 comment