• AK9999
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I need help to query on Task Event to get Opportunity custom fields like Campaign name and Product name. I would like to filter my tasks related to Oppty and Lead based on product name and campaign name.

String LeadObjName= 'Lead'; String OpportunityObjName= 'Opportunity'; String Completedsatatus= 'Completed';
String queryStr='select Id, Subject, Status,ActivityDate,Priority, OwnerId, Owner.Name, Owner.IsActive,Description,WhoId,Who.Name,WhatId, What.Name,AccountId,Account.Name '; queryStr+=' from Task where OwnerId = :userId and (Who.Type =:LeadObjName OR What.Type = :OpportunityObjName ) '; queryStr+=' and Status !=:Completedsatatus'; queryStr+=' order by ActivityDate ASC, Priority DESC';
Ques: We want to access opportunity and lead custom fields in my query but not able to add custom fields here in this query Thanks in Advance!
  • January 28, 2018
  • Like
  • 0