Tracking Asset Attributes Changed
We have an interest in tracking changes to attribute fields made to assets and then notifying stakeholders through email tasks. To this end, we intend to develop a workflow triggered by the Start Event “Asset Attribute Changed.”
Given that there is no form for a start user to utilize, and we will lock down the workflow only for use by those with sysadmin permissions, I am assuming when developing this workflow that I can leave form properties in the start event blank when working in Eclipse IDE. This may or may not be an incorrect assumption.
With that assumption intact, I’d like to get to a second, script task wherein it seems we should be utilizing the interface NamedDescribedWorkflowStartEventType to set variables for distribution through a later mail task. The modifier WorkflowStartEventType that retrieves the event type may or may not be of much interest, given that we have yet to see what the getDescription() method actually spits out: a “human-readable” description that may be sufficiently encompassing our needs.
The following is my attempt thus far at the body of the script task “Main config:”
import com.collibra.dgc.core.api.model.workflow.NamedDescribedWorkflowStartEventType
String startEventName = WorkflowStartEventType getEventType(getName());
String startEventDescription = WorkflowStartEventType getEventType(getDescription());
execution.setVariable("name", startEventName);
execution.setVariable("description", startEventDescription);
Now, I may be wildly off base. If any of you would have suggestions as to how to improve this script task, please, I would greatly appreciate it.
So far, I am receiving the following chastisement from the Console:
No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getName() is applicable for argument types: () values: []
Given that we could apply different workflows in this model to different domains piecemeal, it is my hope that custom text in a subsequent mail task could provide appropriate context for the content of these variables. Thanks.
prasanthiramaswamy
·2 years ago · EditedMay I please check with you what class is to be imported for this:
def domainValue2Name = domainApi.getDomain(domainValue2).getName()
Thank you!
prasanthiramaswamy
·2 years ago · EditedMay I please check with you what class is to be imported for this:
def domainValue2Name = domainApi.getDomain(domainValue2).getName()
Thank you!
Paresh Maharana
·2 years ago · EditedHi Prashanthi,
import com.collibra.dgc.core.api.component.instance.DomainApi
Please use this.
Thanks,
Paresh
manrichkotze
·3 years ago · EditedHi guys, coming in from the side here. We are also in need of a workflow that will showcase all assets where responsibilities was adjusted and it sends an email to a specific person to review. This is linked to our ownership model, we would like to see what assets have been updated responsibilities changes. Is there something like this?
@arthur.burkhardt
arthurburkhardt
·3 years ago · EditedSure, multiple ways.
manrichkotze
·3 years ago · EditedThank Arthur, much appreciated. Do you know if there is an existing workflow for this?
arthurburkhardt
·3 years ago · EditedNo, not that I’m aware of
shaileshkumar
·3 years ago · Edited@arthur.burkhardt, in the example that you shared I can see that it was working fine with both Access granted and revoked. I am just wondering if I can use similar approach to keep track of the relations that have been deleted?
Sean Pyle
·3 years ago · Edited@tyler.bass.tmrhq2.com , here is some code that worked for me to get the label and description. I used the FindWorkflowDefinitionsRequest to isolate the current workflow and a business item workflow bean. Cheers!
arthurburkhardt
·3 years ago · EditedI may be wrong, but I’m not sure that meets the need of the first post. This code queries a workflow instance rather than intercepting workflow events.
Yes, absolutely
Do a little trial/error since the workflow event interception is not atomic (the code is not blocked to ensure all events have been processed before the code runs). As I said in the post, 1s seems to be a reasonable delay.
Sean Pyle
·3 years ago · Edited@arthur.burkhardt, I think if he is only trying to capture the workflow’s start event label and description, the code itself doesn’t need to intercept any workflow events. If this workflow is set to be triggered when an asset attribute is changed, the code is activated in response to a workflow start event. However, he could add more information about the business item which triggered the workflow with the item workflow bean.
arthurburkhardt
·3 years ago · EditedThis is literally the first line of the thread.
Sean Pyle
·3 years ago · EditedI meant to say I set up my example so it was triggered by the “Asset Attribute Changed” Start Event in the Colliibra workflow settings, as you just noted (should have included that detail! ). The script task within the workflow i wrote, doesn’t need workflow beans since he only wanted the workflow’s start label and desc (at least as I could gather from his code block), but if he wanted to link those details to the item that triggered it, he could also use the item bean.
arthurburkhardt
·3 years ago · EditedIndeed @tyler.bass.tmrhq2.com , the notification workflow is great to get daily notification about all changes.
Here’s a code snippet that does something very close to what you’re looking for. It tracks responsibilities instead of attributes, but it’s the same logic.
https://datacitizens.collibra.com/forum/t/how-to-retrieve-in-a-workwflow-a-user-which-had-been-role-granted/1104/5?u=arthur.burkhardt
Keep in mind that performance is probably going to be horrible though, because the workflow would trigger EVERY SINGLE TIME an attribute is modified.
The daily notification is probably a better approach.
keeganshirel
·3 years ago · EditedHi @tyler.bass.tmrhq2.com,
When your workflow is triggered by a start event, you can use the workflow beans to get information about the event. I set a workflow to trigger on asset attribute changed and then changed the description of an asset.
Will yield something like
From here you can get the asset this attribute belongs to then users assigned to responsibilities, etc. If you just want to notify users of a given change, also consider if the built in email notifications could meet your use case.
tylerbass
OP3 years ago · EditedHi, @keegan.shirel.collibra.com,
Customizing this tutorial workflow, I was able to get notifications about the additions of new attribute values or about changes to existing attribute values. Here’s how the “main config” ended up looking in the first script task:
The event of an attribute value’s deletion required the “if” statement since the getEventResourceId() bean, should there be no attribute value left over, would have nothing to call on. The tutorial’s workflow template says that that bean “assigns the UUID of the attribute that started the workflow to an attributeId variable.”
How can one call on the attributeName and assetName variables I effectively used above in a different workflow that aspires to socialize removals of attribute values entirely?
Happy Thanksgiving to all.
Best,
Tyler
Cc @arthur.burkhardt and his mountain of Data Citizens Forum frequent flier miles
keeganshirel
·3 years ago · EditedHi @tyler.bass.tmrhq2.com - I think you’re looking to record the attribute value and attribute type if it has been deleted. In that case, you’ll want to use the activityStreamApi, as Arthur suggested in his first message.
keeganshirel
·3 years ago · EditedHi @tyler.bass.tmrhq2.com,
When your workflow is triggered by a start event, you can use the workflow beans to get information about the event. I set a workflow to trigger on asset attribute changed and then changed the description of an asset.
Will yield something like
From here you can get the asset this attribute belongs to then users assigned to responsibilities, etc. If you just want to notify users of a given change, also consider if the built in email notifications could meet your use case.
Tyler Bass
·3 years ago · EditedHi, Keegan, et al,
So, equipped with these workflow beans to which you have kindly referred me, I am trying to notify users of alterations to a given asset’s status and am having some trouble—particularly, by the look of the console, with isolating the domain name as a variable. The idea of course is that the “Asset Status Changed” start event triggers the workflow. Here is my script task thus far:
The idea is that the variables above could end up in a mail task that includes the following message:
The ${domainValue2Name} asset <b><a href="${assetUrl1}">${assetName}</a></b> has undergone a Status change.An acceptable subject line would be:
${eventType}: ${domainValue2Name} Asset '${assetName}'Ideally, the mail task could even articulate the specific status at which the asset has arrived. So far, the Collibra console is advising me that I am missing a method for getDomainId(). If you or anyone else here would happen to have any input, please, I would appreciate that. Thanks.
Sean Pyle
·3 years ago · EditedTyler, I think it is throwing an error because you aren’t calling
getDomainIdon the item workflow bean.try replacing
def domainValue2 = getDomainId(assetId).toString();with
def domainValue2 = item.getDomainId().toString()Tyler Bass
·3 years ago · EditedHi, Sean,
Thanks and sorry. Trying that, I receive a console message informing me that no signature of the method getDomain() is applicable for the following argument types: “(String) values.”
keeganshirel
·3 years ago · EditedHi @tyler.bass,
it seems like this line is what the message refers to - getDomainId() is not a built-in function but is a method on the business item bean.
I think you want to use this instead
def domainValue2 = item.getDomainId();Note it does not take an argument. And
domainApi.getDomain()takes a UUID argument so you don’t want to convert it to a string. Hope this helps!Tyler Bass
·3 years ago · EditedGood stuff, Keegan. You’re the man.
Here’s what worked for us: