You need to sign in to do that
Don't have an account?

Fetch the User details from the Assigned to field of Task
I want to fetch the username and id of the 'Assigned To' user(Owner) of the task . This field is a Lookup(User,Calendar) field.
I want to extract the info so that i can insert the value into another User LookUp field.
Plz help.
If it's a lookup field, can't you just copy the ID?
That said, you can query for the user the same as you'd query for anything else. You haven't a code sample, or even a premise for what you're trying to do, so I can't really be more helpful at this time.
String TempObj = T.Owner.Id;
System.Debug('Task Owner........' +TempObj);
if(TempObj.substring(0,2)== '005'){
obj.User_1__c = TempObj;
System.Debug('Trigger.oldMap.get(T.Id).Owner....' + T.Owner);
}
obj is of the custom object and User_1_c is the field on the custom object where i am trying to insert the record.
Try this, instead:
I am trying to get the opportunity number from the Realated Opportunity but its not working : PLz help
if(T.What.getsobjecttype() == Opportunity.sobjecttype ) {
String Oppnum == T.What.Opportunity_Number__c;
obj.Text__c = Oppnum;
}
I am not getting the oppty number from the releated opportunity
Rajev,
Change this from
String Oppnum == T.What.Opportunity_Number__c;
to
String Oppnum = T.What.Opportunity_Number__c;
That won't work, Vinit. What is a polymorphic key, and so you can't just drill into it like that. Furthermore, related record data isn't automatically queried, so you need a query anyways:
Hi sfdcfox,
I forgot to see that,good that you reminded.