• Alejandro Ortega Asun
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
Hi,
I'm having problems trying to insert a new case related with an opportunty and a contact (both are previously created and I have a lookup relationship between case and opportunity).
Here is my code:
Case newCase = new Case();
            newCase.RecordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('Test RT').getRecordTypeId();
            newCase.ContactId = contacto.id;
            newCase.Oportunidad__c = opp.Id;
            newCase.Origin = 'Web';
            newCase.Priority = 'Medium';
            newCase.Subject = 'Asunto Test';
            newCase.Description = 'Descripción test';
            newCase.Type = 'Test';
            newCase.Status= 'Nuevo';

                insert newCase; //INVALID_CROSS_REFERENCE_KEY here


Please, any sugestions?
Thanks in advance.
 

Alex.

Hi!
I'm blocked in an Apex field update in Case object.
On the one hand, I have a class that have 2 decimal variables that must have values depending on case fields:

Apex Class
public class HelloWorld{
         public static decimal helloWorld2(){
         decimal x;
         decimal y;
         case c = new Case;
                if(c.CustomField1__c == 'A'){x = 1}else{x=0}
                if(c.CustomField2__c == 'B'){y = 1}else{y=0}
                c.CustomField3__c = x+y;
}
}

On the other hand, I have a trigger that calls the class method:

Trigger
trigger CaseTrigger on Case (before insert, before update, after insert) {
    if (Trigger.isBefore) {
        if (Trigger.isInsert) {
              HelloWorld.helloWorld2( Trigger.new );
        }}}

With this code I have an error like "Method does not exist or incorrect signature: void helloWorld2(List<Case>) from the type HelloWorld"

I'm new in Apex and I will be appreciated if someone can give any help.

Regards,

Alex.
Hi!
I'm blocked in an Apex field update in Case object.
On the one hand, I have a class that have 2 decimal variables that must have values depending on case fields:

Apex Class
public class HelloWorld{
         public static decimal helloWorld2(){
         decimal x;
         decimal y;
         case c = new Case;
                if(c.CustomField1__c == 'A'){x = 1}else{x=0}
                if(c.CustomField2__c == 'B'){y = 1}else{y=0}
                c.CustomField3__c = x+y;
}
}

On the other hand, I have a trigger that calls the class method:

Trigger
trigger CaseTrigger on Case (before insert, before update, after insert) {
    if (Trigger.isBefore) {
        if (Trigger.isInsert) {
              HelloWorld.helloWorld2( Trigger.new );
        }}}

With this code I have an error like "Method does not exist or incorrect signature: void helloWorld2(List<Case>) from the type HelloWorld"

I'm new in Apex and I will be appreciated if someone can give any help.

Regards,

Alex.
Part of the questions asks for the following:

"Change the 'UUID' field on the 'Phone__x' external object to be an indirect lookup relationship to the 'User' standard object. Use the 'Phone_UUID__c' field as the matching key for this indirect lookup relationship."

Every time I create this Indirect Relationship, it just allows me to select the "Accounts" Object, not the User object. Why is this happening? Can anyone help me with this issue?

Thanks!
  • April 06, 2016
  • Like
  • 0