cancel
Showing results for 
Search instead for 
Did you mean: 

Passing opportunity ID field to activity task screen

former_member189296
Active Participant
0 Kudos

Hi Experts,

We want to show Opportunity ID field in activity task header screen. So the scenario is Opportunity ID should be stored in a extension field created in Task header screen.

So this is like passing the standard field value from one business object to another.

I tried doing this with the help of process extension scenario but no such scenario exists.

In our case we are creating Opportunity and then a new task as follow up.

How can I do this ? Request you to kindly help .

Regards,

Saurabh Sharma

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Saurabh,

If you are creating task from Opportunity then you will get Opportunity ID under Activity.BusinessTransactionDocumentReference.BusinessTransactionDocumentReference.ID

You can use below script in BeforeSave of Activity Extension BO.

foreach(var i in this.BusinessTransactionDocumentReference)
{
//TypeCode 72 is for opportunity
if(i.BusinessTransactionDocumentReference.TypeCode.Matches("72") && i.BusinessTransactionDocumentRelationshipRoleCode.Matches("1"))
{
//ID is your extension field created on Task header screen
this.ID = i.BusinessTransactionDocumentReference.ID;
}
}

Regards,

Sujata

former_member189296
Active Participant
0 Kudos

Hi Sujata,

Thanks for your reply and providing code.

1) Can you please explain below code snippet:-

i.BusinessTransactionDocumentRelationshipRoleCode.Matches("1")

2) Also if you can tell me where can I find these type codes 1, 72 Etc.?

Thanks & Regards,

Saurabh

0 Kudos
Hi Saurabh,

While creating Task we are checking whether task is creating from Opportunity or not.

Here, BusinessTransactionDocumentReference.TypeCode is checking document type (72 is for Opportunity) and

BusinessTransactionDocumentRelationshipRoleCode is checking relationship between Task and Opportunity(1 denotes Predecessor)


You can find these Type codes under Data Types in Repository Explorer.

Hope this will help you 🙂

Regards,

Sujata

former_member189296
Active Participant
0 Kudos

Hi Sujata,

Thanks for explaining it. And how can I Make the opportunity ID display as link and navigate to the corresponding Opportunity screen? Can you please help?

Regards,

Saurabh Sharma

0 Kudos

Hi Saurabh Sharma,

You can add link to navigate to Opportunity using ID stored in your extension field.

here is the reference to create link:

https://www.youtube.com/watch?v=bhjPsXnGWNw

Regards,

Sujata

Answers (0)