• Alejandro Valcarcel
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
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:
 
# 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.
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:
 
# 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.