cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Link of a Master Agreement via Script.

Former Member
0 Kudos

Hi Experts!

I generated a Script that notifies collaborators whenever a Contract Document has changed it's phase (depending on the phase change, and collaborator role).

It works fine, the only problem I have is that I want to add a Link that will redirect to the actual master agreement that has the contract document.

I tried this manually by generating something like this:

"server:50000/sourcing/fsbuyer/contracts/contracts_summary,"+masterAgreementId+":1004";

where masterAgreementId is the Id of the master agreement. and server is the server where CLM resides.

but the results aren't as I expected them to be.

This is the result I'm getting:

while trying to invoke the method com.sap.odp.doc.display.util.DisplayState.getUiMetadataId() of an object loaded from field com.sap.odp.comp.busobjedit.imbo.BusObjEdit.ds of an object loaded from local variable 'this'



I was wondering if there's a way to get the direct link from the AgreementIBeanIfc.

Or what should I try to achieve this?

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

former_member207877
Active Participant
0 Kudos

Hello Oscar,

In order to generate link to the master agreement, please try as below

1) Create an extension field in company which is by default having the value as

"server:50000/sourcing/fsbuyer/contracts/contracts_summary,"   --> ([protocol]://[hostname]:[port]/[context]/[login type]/[login path])

2) There is a global mail token "DOCUMENT_URL", set it in the Notification parameters as below

params.put("DOCUMENT_URL", getDocumentUrl(doc));

write a method as below in order to pass link to  DOCUMENT_URL


getDocumentUrl(doc)

  {

     docLink = doc.getObjectReference().toLinkString();

     companyRef = contract.getCompanyRef();

     companyHome = IBeanHomeLocator.lookup(session, companyRef);

     company = companyHome.find(companyRef);

     url = company.getExtensionField("Z_DYN_GEN_URL").get();

     action = "?rqaction=load&hook=contract_uirq&allow_redirect=true"

     return url + docLink + action;

  }

Now, the DOCUMENT_URL can be used in mail notifications as %DOCUMENT_URL% Which gives the link to the respective master agreement

Hope it helps!

Regards,

Raj.

Former Member
0 Kudos

It worked!

Thanks a lot Raj!

former_member207877
Active Participant
0 Kudos

Anytime Oscar

Answers (0)