Working with Dates in Collibra Workflows
I have a workflow groovy script requirement where I need to fetch Last Review Date attribute for assets and check if difference between current date and Last Review Date is greater than 365 days then trigger some workflow.
Does anyone has idea how to work with Dates in Collibra using groovy?
sunilkumar1
Posted 2 years ago · Edited 1 year ago·Last reply 2 years ago
2 comments
Brett Hiett
·2 years agoUse the REST Api documentation to help...but get your asset information, the Last Review Date, with something like this (might take some playing around with)
def lastReviewDate= assetApi.findAssets(FindAssetsRequest.builder().domainId(domainId).name("Last Review Date").nameMatchMode(MatchMode.EXACT).sortField(FindAssetsRequest.SortField.NAME).sortOrder(SortOrder.DESC).limit(100).offset(offset).build()).getResults();
You could probably just subtract the two dates with some method and return days.
You'll probably need to import some java time libraries...depends on how you'll change/not change your date.
import java.util.Calendar;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
Paresh Maharana
·2 years ago · EditedHi Sunil,
You can use outputmodule to do sure where you can fetch who the attribute values in one go convert it into long value and compare it.
Thanks,
Paresh