react-nativesalesforcesalesforce-mobile-sdk

How to save data in a salesforce account using react-native?


We are building an Application and we need to store some data to the user's Salesforce account. I looked into some solutions where people are using Apex but I am unable to understand how to use them with React Native.

Please give me some good documentations to refer of How can I save my data from my React Native App to my Salesforce Account.

I tried to look into Apex and visualforce but not understanding how to use it with React Native.


Solution

  • For react Native you will have to call REST API exposed by salesforce. You will need to create a connected app and get the security key and client id. Use them to authenticate and get a access_token. Once you have that token, use it to make a POST call to /services/data/v45.0/sobjects/Account using the account id. Send a JSON payload to add your data.

    Example of a GET call is :

    /services/data/v45.0/sobjects/Account/0013600000udFs8AAE

    Hope this helps!