• Divya Veerisetty
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi,
Requirement
Upon opening the excel, user should be ask for credentials in pop up possibly using which connects to Salesforce, pull data and populate the existing Excel Template. There should be button on the excel which upon click should update Salesforce with the data in excel fields.

We are using REST API. From Excel macro we are able to pull data from SFDC and populate in Excel
We are trying to update excel data back to Salesforce. We want to call UpdateRequest method from Excel VBA script. Can anyone provide any sample code for calling UpdateRequest method.

''
' Setup generic update request
' --------------------------------------- '
Public Function UpdateRequest(ObjectName As String, ObjectId As String, Values As Dictionary) As RestRequest
    Dim Request As RestRequest
    Set Request = ObjectRequest(ObjectName, ObjectId)
   
    ' Remove Id from values for update
    If Values.Exists("Id") Then Values.Remove "Id"
   
    ' Set method and add body
    Request.Method = httpPATCH
    Request.AddBody Values
   
    Set UpdateRequest = Request
End Function