You need to sign in to do that
Don't have an account?
Alejandro Valcarcel
json response after sf.Create.contact
Hi, I'm new to SF, Python and Flask. Wich are the tools I'm using to build up a little web UI for registering (creating anew contact on SF). I found Simple-Salesforce and works pretty well for me. So, right now I have this code wich is working perfectly so far:
What I need is to catch/read the SF Dictionary JSON response with the new created Id as shown on the simple-salesforce examples section:
I will appreciate if someone gives me a hand on this.
# User Registration @app.route('/register', methods=['GET', 'POST']) def register(): form = RegisterForm(request.form) if request.method == 'POST' and form.validate(): FirstName = request.form['FirstName'] LastName = request.form['LastName'] AccountId = request.form['AccountId'] Birthdate = request.form['Birthdate'] #password = sha256_crypt.encrypt(str(form.password.data)) Home_Endpoint__c = request.form['Home_Endpoint__c'] # Execute query sf.Contact.create({'LastName':LastName,'FirstName':FirstName,'AccountId':AccountId, 'Birthdate':Birthdate, 'Home_Endpoint__c':Home_Endpoint__c, 'Test_User__c':1 }) flash('You are now registered', 'success') return render_template('register.html', form=form)
What I need is to catch/read the SF Dictionary JSON response with the new created Id as shown on the simple-salesforce examples section:
Record Management To create a new ‘Contact’ in Salesforce: sf.Contact.create({'LastName':'Smith','Email':'example@example.com'}) This will return a dictionary such as {u'errors': [], u'id': u'003e0000003GuNXAA0', u'success': True}So I can keep working with the new registered member on other further processes.
I will appreciate if someone gives me a hand on this.
The syntax for the callback function is: For more details, please refer to Salesforce documentation:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_remote_objects_using_create.htm
If it helps you, please mark it as best answer.
Thanks,
Neetu
You are suggesting a JS function but I was looking for a Python code solution. Fortunately I already solved this. Thank you anyway.