For the complete documentation index, see llms.txt. This page is also available as Markdown.

Save & update records in objects

There is always a need to ensure records are kept up to date and have the latest contact details, sales figures, or case details. The Salesforce Save or Update methods allow you to update records in Salesforce directly from your mobile device.

Examples and code snippets

Update opportunity amount
Update opportunity amount

This example shows how to update a Salesforce Opportunity record. From the list of opportunities using the onPress action the jig opens a form showing the opportunity name and amount. Edit the amount field. Using the Salesforce Providers save method the opportunity is updated.

:::CodeblockTabs

title: Opportunity Update
description: Update the opportunity Amount
type: jig.default

header:
  type: component.jig-header
  options:
    children:
      type: component.image
      options:
        source:
          uri: https://images.unsplash.com/photo-1509228627152-72ae9ae6848d?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80   
    height: medium
  
datasources:
  opp-amount:
    type: datasource.sqlite
    options:
      provider: DATA_PROVIDER_LOCAL
      entities:
        - entity: Opportunity
      query: SELECT id, '$.Name', '$.Amount' FROM [Opportunity] WHERE id = @id
      queryParameters:
        id: =@ctx.jig.inputs.id
    
children:
  - type: component.form
    instanceId: opp-form
    options:
      children:              
        - type: component.text-field
          instanceId: id
          options:
            initialValue: =@ctx.jig.inputs.id
            isHidden: true
            label: id   
        - type: component.text-field
          instanceId: Name
          options:
            label: Opportunity Name
            initialValue: =@ctx.datasources.opp-amount.Name
        - type: component.number-field
          instanceId: Amount
          options:
            label: Amount 
            initialValue: =@ctx.datasources.opp-amount.Amount
       
actions:
  - children:
      - type: action.submit-form
        options:
          title: Update Amount
          provider: DATA_PROVIDER_SALESFORCE
          entity: Opportunity
          formId: opp-form
          method: save
          data:
            id: =@ctx.components.id.state.value
            Amount: =@ctx.components.Amount.state.value
          onSuccess: 
            type: action.go-back  

Last updated

Was this helpful?