• Shivendra Singh Pawar
  • NEWBIE
  • 40 Points
  • Member since 2019
  • Software Developer
  • BISP Solutions


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 5
    Replies
Hi,
Greetings of the day!

I am working on PHP and Salesforce integration and I want to update records using PHP data table.

Table Showing records from  salesforce

Now I want to update records in salesforce when clicking on the checkbox.
And also try the below code. 
function update_account($id, $followup, $instance_url, $access_token) {
    $url = "$instance_url/services/data/v20.0/sobjects/Contact/$id";

    $content = json_encode(array("shivendra__FollowUp__c" => $followup));
    echo $content;
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_HTTPHEADER,
            array("Authorization: OAuth $access_token",
                "Content-type: application/json"));
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
    curl_setopt($curl, CURLOPT_POSTFIELDS, $content);

    curl_exec($curl);

    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

    if ( $status != 204 ) {
        die("Error: call to URL $url failed with status $status, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl));
    }
    echo "<b>update_contact function</b>";
    echo "HTTP status $status updating Contact<br/><br/>";

    curl_close($curl);
}
But getting an error:

{"shivendra__FollowUp__c":null}[{"errorCode":"METHOD_NOT_ALLOWED","message":"HTTP Method 'PATCH' not allowed. Allowed are HEAD,GET,POST"}]Error: call to URL https://shivendra-dev-ed.my.salesforce.com/services/data/v20.0/sobjects/Contact/ failed with status 405, curl_error , curl_errno 0

It would be great if some urgently help me...


Thanks and Regards 
Shivendra Singh Pawar
Dear Team,

Greetings !!!

I am using inline editing using lightning datatable, everything is working fine but the output is appearing in disturb format. Kindly have a look at the attached image. Plz, suggest me some solution.

After executing this is output


Thanks & Regards
Shinendra
Dear Team,

Greetings !!!

We have created lightning: button in .cmp file. On .js file, we have written code for insert, after data saved all textboxes getting blank. Now we have to display the success message box. Plz, let us know how to display a message box. Code is as follows :
 
save: function(component, event) {
    var getCon = component.get("v.NewCon");

    var action = component.get("c.CreateNewContact");

    action.setParams({
      con: getCon
    });

    action.setCallback(this, function(a) {
      var state = a.getState();

      if (state === "SUCCESS") {
        var name = a.getReturnValue();

        component.set("v.NewCon.FirstName", "");
        component.set("v.NewCon.LastName", "");
        component.set("v.NewCon.Email", "");
        component.set("v.NewCon.Phone", "");
        component.set("v.NewCon.Description", "");
      }
    });

 

Hi 

Greetings of the day!!!

I create a country picklist into contact object in Sales app and i want to use it into lightning component to select a country from the <select> in the form,

I am not getting, how I can call a picklist into a lightning component from.

<lightning:select aura:id="NewCon" label="Course" name="NewCon" type="String" value="{!v.NewCon.CourseCategory__c}" required="true"/>

Hi 
Greetings of the day...

I am designing a Lightning component using Developer console and on adding it to Lightning App Builder, I am not finding any custom tab to add my component to the Lightning page.


User-added image


Plz. help us to add a lightning component in the custom section.
We  have a custom Object and fields,
What I want is to fill the form and insert a record to the Student Object.

Someone, please help me..!!


Below is the Code:

Visualforce page :

<apex:pageBlockButtons > 
                <apex:commandButton action="{!insertField}" value="Save"/> 
            </apex:pageBlockButtons> 
            <apex:pageBlockSection title="Crud Operation Using Apex and Visualforce" columns="2" collapsible="true"> 
                <apex:inputField value="{!stud.Name}"/>
                <apex:inputField value="{!stud.shivendra__Phone__c}"/>
                <apex:inputField value="{!stud.shivendra__Email__c}"/>
                <apex:inputField value="{!stud.shivendra__Age__c}"/>
                <apex:inputField value="{!stud.shivendra__State__c}"/>
                <apex:inputField value="{!stud.shivendra__City__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock> 


Apex Class Code:

public class crud1 {
    
    // Instance to use Fields API in a a VF Page
    public shivendra__Student__c stud {get; set;}
    
    public String Name {get; set;}
    public String Email {get; set;}
    public String Age {get; set;}
    public String Phone {get; set;}
    public String State {get; set;}
    public String City {get; set;}
    
    //Function used to Insert a Record
    public PageReference insertField(){
        shivendra__Student__c studentRecord = new shivendra__Student__c();
        
        studentRecord.name = Name;
        studentRecord.shivendra__Phone__c = stud.shivendra__Phone__c;    
        studentRecord.shivendra__Email__c = Email;
        studentRecord.shivendra__Age__c = Age;
        studentRecord.shivendra__State__c = State;
        studentRecord.shivendra__City__c = City;
        
        insert studentRecord;        
        pagereference ref = new pagereference('/apex/CrudOperations1');
        ref.setredirect(true);
        return ref;        
    }   
  
}

Hi 

Greetings of the day!!!

I create a country picklist into contact object in Sales app and i want to use it into lightning component to select a country from the <select> in the form,

I am not getting, how I can call a picklist into a lightning component from.

<lightning:select aura:id="NewCon" label="Course" name="NewCon" type="String" value="{!v.NewCon.CourseCategory__c}" required="true"/>

Hi 
Greetings of the day...

I am designing a Lightning component using Developer console and on adding it to Lightning App Builder, I am not finding any custom tab to add my component to the Lightning page.


User-added image


Plz. help us to add a lightning component in the custom section.
We  have a custom Object and fields,
What I want is to fill the form and insert a record to the Student Object.

Someone, please help me..!!


Below is the Code:

Visualforce page :

<apex:pageBlockButtons > 
                <apex:commandButton action="{!insertField}" value="Save"/> 
            </apex:pageBlockButtons> 
            <apex:pageBlockSection title="Crud Operation Using Apex and Visualforce" columns="2" collapsible="true"> 
                <apex:inputField value="{!stud.Name}"/>
                <apex:inputField value="{!stud.shivendra__Phone__c}"/>
                <apex:inputField value="{!stud.shivendra__Email__c}"/>
                <apex:inputField value="{!stud.shivendra__Age__c}"/>
                <apex:inputField value="{!stud.shivendra__State__c}"/>
                <apex:inputField value="{!stud.shivendra__City__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock> 


Apex Class Code:

public class crud1 {
    
    // Instance to use Fields API in a a VF Page
    public shivendra__Student__c stud {get; set;}
    
    public String Name {get; set;}
    public String Email {get; set;}
    public String Age {get; set;}
    public String Phone {get; set;}
    public String State {get; set;}
    public String City {get; set;}
    
    //Function used to Insert a Record
    public PageReference insertField(){
        shivendra__Student__c studentRecord = new shivendra__Student__c();
        
        studentRecord.name = Name;
        studentRecord.shivendra__Phone__c = stud.shivendra__Phone__c;    
        studentRecord.shivendra__Email__c = Email;
        studentRecord.shivendra__Age__c = Age;
        studentRecord.shivendra__State__c = State;
        studentRecord.shivendra__City__c = City;
        
        insert studentRecord;        
        pagereference ref = new pagereference('/apex/CrudOperations1');
        ref.setredirect(true);
        return ref;        
    }   
  
}