• Sheikh Abrar Ul Haq
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 7
    Replies

Hi All,

 

I need your attention for unknown functionality for me of Salesforce.com/Force.com platform. I am doing UPSERT without External ID on an object. I have a custom object "Sales Order Summary" which is a child object of Account via Master-Detail relationship.

 

I am doing UPSERT with standard Name field of custom object "Sales Order Summary". Before this, Only thing which I knew was doing UPSERT with an External ID on an object. It is working Perfect !!! for me. I am just confirming from you guys (Guru's of Force.com platform) that whether it is ok to do it or I should query the records and perform INSERT / UPDATE based on condition. Please help me out in it.

 

Note: Following things I already know about the UPSERT.

1) UPSERT with External ID (I cannot create External ID on this object due of some reasons).

2) Query records and perform INSERT / UPDATE based on condition.

________________________________________________________________________________________

//Sample Order Summary Code for UPSERT in Apex

 

//List of Sales Order Summary for UPSERT
List<Sales_Order_Summary__c> listOfSalesOrderSummaryToUpsert = new List<Sales_Order_Summary__c>();

//Created a new Account "Test Sales Order Summary" with JDE Address Number = 1001

//JDE Address Number is an External ID on an Account. I am getting particular record.
Account a = new Account (JDE_AddressNumber__c = 1001);

//Create Sales Order Summary records
for(integer i=0; i<=13; i++){
    Sales_Order_Summary__c salesOrder = new Sales_Order_Summary__c();
    salesOrder.Account__r = a;
    salesOrder.Name = 'Sales Order Summary'+'---'+i;
    salesOrder.Amount__c = 300 + i;
    salesOrder.Date__c = System.today() + i;
    listOfSalesOrderSummaryToUpsert.add(salesOrder);
}

//The External_ID_Field is of type Schema.SObjectField, that is, a field token.
Schema.SObjectField schemaField = Sales_Order_Summary__c.Fields.Name;

 

//Creates new sObject records or updates existing sObject records within a single statement, using an optional custom field to determine the presence of existing objects.
Database.UpsertResult[] upsertResult = Database.upsert(listOfSalesOrderSummaryToUpsert, schemaField, false);
System.Debug('>>> Sales Order Summary UPSERT Result <<<'+upsertResult);

 
/*
Note: You cannot use custom fields as a parameter of Schema field.
Schema.SObjectField schemaField = Sales_Order_Summary__c.Fields.Date_c;
Note: If you use then you will get an error
System.SObjectException: Invalid field for upsert, must be an External Id custom or standard indexed field: Date__c
*/

Hi All,

 

I need your attention for unknown functionality for me of Salesforce.com/Force.com platform. I am doing UPSERT without External ID on an object. I have a custom object "Sales Order Summary" which is a child object of Account via Master-Detail relationship.

 

I am doing UPSERT with standard Name field of custom object "Sales Order Summary". Before this, Only thing which I knew was doing UPSERT with an External ID on an object. It is working Perfect !!! for me. I am just confirming from you guys (Guru's of Force.com platform) that whether it is ok to do it or I should query the records and perform INSERT / UPDATE based on condition. Please help me out in it.

 

Note: Following things I already know about the UPSERT.

1) UPSERT with External ID (I cannot create External ID on this object due of some reasons).

2) Query records and perform INSERT / UPDATE based on condition.

________________________________________________________________________________________

//Sample Order Summary Code for UPSERT in Apex

 

//List of Sales Order Summary for UPSERT
List<Sales_Order_Summary__c> listOfSalesOrderSummaryToUpsert = new List<Sales_Order_Summary__c>();

//Created a new Account "Test Sales Order Summary" with JDE Address Number = 1001

//JDE Address Number is an External ID on an Account. I am getting particular record.
Account a = new Account (JDE_AddressNumber__c = 1001);

//Create Sales Order Summary records
for(integer i=0; i<=13; i++){
    Sales_Order_Summary__c salesOrder = new Sales_Order_Summary__c();
    salesOrder.Account__r = a;
    salesOrder.Name = 'Sales Order Summary'+'---'+i;
    salesOrder.Amount__c = 300 + i;
    salesOrder.Date__c = System.today() + i;
    listOfSalesOrderSummaryToUpsert.add(salesOrder);
}

//The External_ID_Field is of type Schema.SObjectField, that is, a field token.
Schema.SObjectField schemaField = Sales_Order_Summary__c.Fields.Name;

 

//Creates new sObject records or updates existing sObject records within a single statement, using an optional custom field to determine the presence of existing objects.
Database.UpsertResult[] upsertResult = Database.upsert(listOfSalesOrderSummaryToUpsert, schemaField, false);
System.Debug('>>> Sales Order Summary UPSERT Result <<<'+upsertResult);

 
/*
Note: You cannot use custom fields as a parameter of Schema field.
Schema.SObjectField schemaField = Sales_Order_Summary__c.Fields.Date_c;
Note: If you use then you will get an error
System.SObjectException: Invalid field for upsert, must be an External Id custom or standard indexed field: Date__c
*/

Hi,

I have enabled person account in my org. I have created record types in Leads - Person Leads and Business Leads.

When converting a lead to account how can i convert a Person Lead to Person Account and Business Lead to Business Lead. (I have two custom vf pages for creation of person account and business account respectively.)

When i am trying to convert a person lead into person account, following error is thrown on 'Converted Status' field(when selected as qualified).

 

Error: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Last Name]: [Last Name] (System Code)

 

Any help will be appreciated

hi every one

 

public class CallWSDLMethod{
 @future(callout=true)
  public static void hi(Id d){
   Book__c b=[select name,Author_name__c from Book__c where id=:d];
 
partnerSoapSforceCom.Soap obj1=new partnerSoapSforceCom.Soap();
partnerSoapSforceCom.LoginResult x=obj1.login('naveenbathula@sfdc.com','9395311706@bnktxFhyI9yuUkFZAKr6gju5p5rd');

soapSforceComSchemasClassS2ssoapaut.s2ssoapauto obj = new soapSforceComSchemasClassS2ssoapaut.s2ssoapauto();
obj.sessionHeader=new soapSforceComSchemasClassS2ssoapaut.sessionHeader_element();
obj.sessionHeader.sessionid=x.sessionId;
obj.mm(b.name,b.author_name__c);
}
}

 

i wrote above pragram for salesforce (org1) to salesforce (org2) integration dano successfully but if  remove callout=true  data is not inserting into org2 .

 

What is actual purpose of @future annotation ?

 

what is the use of callout=true?

 

Hi,

 

I want to access two child object record on vf page with standard controller of one child object.

Both the child object have same master object.

I want to override this visualforce page on edit button of one of the child.

 

I am getting following error: Error: FollowUpAssEditController Compile Error: unexpected token: '=' at line 20 column 20

 

my controller code is:

 

public class FollowUpAssEditController {

public Questionnaires__c questionnaires;
    public Clinical_History__c clinicalhistory;
    

    public FollowUpAssEditController(ApexPages.StandardController controller) {
    
     String id = ((Questionnaires__c)controller.getRecord()).id;
        this.questionnaires = [Select q.Has_Your_Snoring_Resolved_On_Treatment__c, q.Has_Your_Level_Of_Daytime_Sleepiness_Dec__c, q.Witnessed_Apnoeas__c,q.Any_Reports_Of_Mouth_Breathing_ByPartner__c, q.Dry_Mouth_Sore_Throat_In_The_Morning__c from Questionnaires__c q where q.id=:id];


    }
    
    String parent_id=Clinical_History__c.ParentId;
    
   // Id parentId = Clinical_History__c.Account__c;
    
   
    clinicalhistory = [Select c.Severity__c from Clinical_History__c c where c.id=:parent_id];
    
       public PageReference edit() {
        return null;
    }


    


    public Questionnaires__c getQuestionnaires() {
        return questionnaires;
    }
    
    public Clinical_History__c getclinicalhistory() {
        return clinicalhistory;
    }

    public PageReference save() {
        update questionnaires;
        return null;
    }


}

 

Kindly Help.

Regards,
Mayur

 

 

How do I query the Territories that are associated with an Account?  I found another thread that mentioned the AccountShare object, but I don't see how that helps...

Thanks
Chris
  • August 05, 2008
  • Like
  • 0