• Mr Mehedi Hasan
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
0
Good day people. Let me state my problem. I've my own org also one client org. There's some custom fields on client's org for Account object. But, my org doesn't have those custom fields, moreover there are some lookup relationship with these custom field. So, I had to create the custom field manually and set the lookup relationships in my org. That means:
1. I've created same field as my custom's org.
2. Used that field for lookup relationship, same as customer's org.
3. Now created a package to deploy on custom org.
But, while trying to deploy the package, I'm facing duplicate relationship error, as the custom field on Account object is same as mine. I intend to keep this that way without changing my custom field name or anything. Is there any proper solution to this? Thanks in advance.
User-added image
Hi, 
  
  I want to get the latest record from the query below please suggest me a logic. 
list<case> ctendays = [select id, casenumber,subject,createddate,ownerid,owner.name from case where CreatedDate = this_year and subject like :('%' + CaseSubject + '%') order by createddate asc limit 10];

Thanks
  • February 14, 2019
  • Like
  • 0

Hi,

 

    I have a requirement, where in I need to assign the text that is present in Comments field of Steps in ProcessInstance to Approved Comments field of Opportunity.  So, kindly suggest a solution to the above mentioned problems.  

 

 

Trigger:


trigger ApprTrigger on Opportunity (after insert,before update) {
Opportunity [] o = Trigger.new;
ApprProcess.ProcessInst(o);
}

 

 

 

Apex Class: 

 

 

 

public class ApprProcess

{
public static void ProcessInst(Opportunity [] o1)
{
for(Opportunity  o2:o1)
{
ProcessInstance [] op = [SELECT Id,Status,(SELECT Id, StepStatus, Comments FROM Steps)FROM ProcessInstance limit 1];
for (ProcessInstance op1 : op)
{
if(op1.Status == 'Approved')
{
o2.Approved_Comments__c = op1.ProcessInstanceStep.comments;
}
}
}  
}

 

 


 

The reference site that I have used is http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_erd_process.htm

 

 

When I am saving the above class I am getting the following error.

ErrorError: Compile Error: Invalid foreign key relationship: ProcessInstance.ProcessInstanceStep at line 12 column 27

 

 

So, can anyone suggest a solution for the above mentioned problem.

 

 

Regards

 

Arun