Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-5924

Salesforce: UPDATE doesn't work when setting null values

XMLWordPrintable

    • 0.5
    • Hide

      1. add salesforce resource adapter in standalone-teiid.xml:

                      <resource-adapter id="salesforce-34">
                          <module slot="main" id="org.jboss.teiid.resource-adapter.salesforce-34"/>
                          <connection-definitions>
                              <connection-definition class-name="org.teiid.resource.adapter.salesforce.SalesForceManagedConnectionFactory" jndi-name="java:/salesforce34" enabled="true" use-java-context="true" pool-name="sfDS34">
                                 <config-property name="URL">
                                    https://login.salesforce.com/services/Soap/u/34.0
                                 </config-property>
                                 <config-property name="username">
                                    xxxxx
                                 </config-property>
                                 <config-property name="password">
                                    xxxxx
                                 </config-property>
                              </connection-definition>
                          </connection-definitions>
                      </resource-adapter>
      

      2. add sf34 model:

          <model visible="true" name="sf34">
              <source name="sf34" translator-name="mySalesforce-34" connection-jndi-name="java:/salesforce34"/>    
          </model>
          <translator name="mySalesforce-34" type="salesforce-34">
              <property name="SupportsNativeQueries" value="true"/>
          </translator>
      

      3. in Teiid create the test data:

      insert into sf34.Contact (OwnerId, LastName, Birthdate) values ('005i0000002dtHTAAY', 'test_updates_null', '2020-03-22') ;;
      

      4. run the following queries:

      select w.* from (call sf34.native('update;type=Contact;attributes=id, OwnerId, LastName, Birthdate', '0031Y000062bY4aQAE', '005i0000002dtHTAAY', 'test_updates_null', null)) as w ;;
       	
      update sf34.Contact set Birthdate = null where LastName = 'test_updates_null' ;;
      

      5. check whether the Birthdate value was changed or not:

      select OwnerId, LastName, Birthdate from sf34.Contact where LastName = 'test_updates_null' ;;
      
      Show
      1. add salesforce resource adapter in standalone-teiid.xml: <resource-adapter id= "salesforce-34" > <module slot= "main" id= "org.jboss.teiid.resource-adapter.salesforce-34" /> <connection-definitions> <connection-definition class-name= "org.teiid.resource.adapter.salesforce.SalesForceManagedConnectionFactory" jndi-name= "java:/salesforce34" enabled= "true" use-java-context= "true" pool-name= "sfDS34" > <config-property name= "URL" > https://login.salesforce.com/services/Soap/u/34.0 </config-property> <config-property name= "username" > xxxxx </config-property> <config-property name= "password" > xxxxx </config-property> </connection-definition> </connection-definitions> </resource-adapter> 2. add sf34 model: <model visible= "true" name= "sf34" > <source name= "sf34" translator-name= "mySalesforce-34" connection-jndi-name= "java:/salesforce34" /> </model> <translator name= "mySalesforce-34" type= "salesforce-34" > <property name= "SupportsNativeQueries" value= "true" /> </translator> 3. in Teiid create the test data: insert into sf34.Contact (OwnerId, LastName, Birthdate) values ( '005i0000002dtHTAAY' , 'test_updates_null' , '2020-03-22' ) ;; 4. run the following queries: select w.* from ( call sf34.native( ' update ; type =Contact; attributes =id, OwnerId, LastName, Birthdate' , '0031Y000062bY4aQAE' , '005i0000002dtHTAAY' , 'test_updates_null' , null )) as w ;; update sf34.Contact set Birthdate = null where LastName = 'test_updates_null' ;; 5. check whether the Birthdate value was changed or not: select OwnerId, LastName, Birthdate from sf34.Contact where LastName = 'test_updates_null' ;;

      UPDATE command doesn't work when setting null values:

      select w.* from (call sf34.native('update;type=Contact;attributes=id, OwnerId, LastName, Birthdate', '0031Y000062bY4aQAE', '005i0000002dtHTAAY', 'test_updates_null', null)) as w ;;
       	
      update sf34.Contact set Birthdate = null where LastName = 'test_updates_null' ;;
      

      queries do nothing. The query:

      select OwnerId, LastName, Birthdate from sf34.Contact where LastName = 'test_updates_null' ;;
      

      will return the same result as before running these UPDATE commands.

              rhn-engineering-shawkins Steven Hawkins
              dalex005 Dmitrii Pogorelov
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h