cancel
Showing results for 
Search instead for 
Did you mean: 

Populating Employee Responsible on Task in After Modify event

sumeet_narang
Active Participant
0 Kudos

Hi, I have a requirement to code the After Modify event of Task Extended BO. If the Category on the task has some specific value, then the Owner needs to change.

Below is the code I have put in the After Modify event:

import ABSL;

import AP.PC.IdentityManagement.Global;

import AP.FO.BusinessPartner.Global;

import AP.PC.ActivityManagement.Global;

var elActivityParty : elementsof Activity.Party;

if (this.GroupCode.content == "Z001") {

elActivityParty.PartyName = "Sumeet Narang";

elActivityParty.RoleCode = "39"; //Employee Responsible = 39

this.EmployeeResponsibleParty.Create(elActivityParty);

}

I am getting the error "Please enter a party with role Employee Responsible". The Employee Responsible is getting created, but the ID is blank. Also I am not able to change the PartyID as it is a read only field. What else needs to be done in this case? We are using Cloud Application Studio 1408.

Regards,

Sumeet

Accepted Solutions (0)

Answers (2)

Answers (2)

sumeet_narang
Active Participant
0 Kudos

Hi All,

Just to close this thread, this issue is sorted in the 1411 release.

Thanks a lot for for inputs on this.

Former Member
0 Kudos

Hi Sumeet,

There is one workaround which works fine for me, and I figured out last friday.

You can simply assign the BP ID to the PartyName field:


yourActivityTask.ProcessorParty.PartyName = partyBPID;


This will automatically load all the new party's data.

Just have a try and let me know.

Thanks!

Fernando

Former Member
0 Kudos

Hi Sumeet,

Try changing from this line:

this.EmployeeResponsibleParty.Create(elActivityParty);


To this one:

this.Party.Create(elActivityParty);


I believe the fact you are already filling the role code as "Employee Responsible" should automatically populate "EmployeeResponsibleParty". In case you already have one, you might need to delete it.

Try to play with that and let us know the outcome.

Thanks.

Fernando

sumeet_narang
Active Participant
0 Kudos

Hi Fernando,

Thanks very much for your response.

I already tried the above suggested.

Even while using the EmployeeResponsibleParty, if I don't pass the role code it gives me an error to populate the role code.

It creates a blank Employee Responsible row in the Involved Parties with no Employee ID and no details and the error as "Please enter a party with role Employee Responsible".

Appreciate some more suggestions on this.

Former Member
0 Kudos

Hello Sumeet,

You can use the EmployeeResponsibleParty association directly instead of passing the role code to Party Node.

Please only pass the Party Name and create the EmployeeResponsibleParty association.

Please let me know if that works fine.

Thanks & Regards,

Meghna Sharma

sumeet_narang
Active Participant
0 Kudos

Hi Meghna,

Thanks for your response.

If I only pass the party name I get another error for Role Code as well.

Regards,

Sumeet

Former Member
0 Kudos

Hello Sumeet,

You can also check if the association EmployeeResponsibleParty is already set or not.

If it is set just update the already existing instance with party name otherwise do create.

Please check if that helps.

Thanks & Regards,

Meghna Sharma

sumeet_narang
Active Participant
0 Kudos

Hi Meghna,

If the Employee Responsible is set, changing the Party Name doesn't do anything.

this.EmployeeResponsibleParty.PartyName = "Sumeet Narang"

The Employee responsible remains as the previous value only.

Ideally it should work. Is there something in the Business Configuration that could be missing?

I am manually able to change the Owner of the task on the UI.

Thanks and Regards,

Sumeet Narang

Former Member
0 Kudos

Hi, try using the business partner id instad of the name:

elActivityParty.PartyName = "800010010";

elActivityParty.RoleCode = "39"; //Employee Responsible = 39

this.EmployeeResponsibleParty.Create(elActivityParty);

sumeet_narang
Active Participant
0 Kudos

Hi Alessandro,

Thanks for your response.

I already tried using the ID. Also tried with the Email ID. None worked.

Regards,

Sumeet Narang