function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Noehms ZapantaNoehms Zapanta 

Update a record (case) via Python

Hi,

I'm quite new to SalesForce and I've been trying to build a Python script that allows me to update a specific record like case, account, etc.
I really need help on this as I am stuck right now finding a solution.  Your help and guidance will be very much appreciated.

Thanks in advance...
NagendraNagendra (Salesforce Developers) 
Hi Zepanta,

Please check with below links which have real good information on how to update records in salesforce using python. Please let us know if you are looking for something else.

Kindly mark this as solved if the information helps so that it gets removed from the unanswered queue which results in helping others who are encountering similar issue.

Best Regards,
Nagendra.
Noehms ZapantaNoehms Zapanta
Hi Nagendra,

I am trying to update the description of a case. I have installed the simple_salesforce module and created the following lines of codes but it is giving me the
 
from simple_salesforce import Salesforce
sf = Salesforce(username=myusermail@gmail.com', password='MyPassword, security_token='mySecurityToken')
sf.Case.update('0017F000002JM5BQAW',{'Description': 'New Description updated'})

However,  if I run the code above, it is giving me the error below. Not sure where I am doing it wrong. Please help.
 
simple_salesforce.api.SalesforceResourceNotFound: Resource Case Not Found. Response content: [{'errorCode': 'NOT_FOUND', 'message': 'The requested resource does not exist'}]

Thanks in advance....
Keaton KleinKeaton Klein
Hi Noehms,
I know this question is old but I just ran accross it and noticed you never got an answer.  Your code is correct, your ID is just incorrect.  "0017F000002JM5BQAW" probably does not reference a case in your organization.  Test it by pulling up a browser, log into Salesforce, try and navigate to https://na74.salesforce.com/0017F000002JM5BQAW

Of course you need to replace na74 with your orgs prefix.  I imagine you will end up on a "DATA NOT AVAILABLE" page.  Something else to remmber is that IDs are case sensitive which could be your problem.