Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am using the below query in tSalesforceInput component.
" select id from Account where Id = '"+globalMap.get("f4.AccountId" ).toString() + "' AND Brand__c in ( '"+globalMap.get("f4.Brand_1").toString() +"' , '"+globalMap.get("f4.Brand_2").toString() +"' , '"+globalMap.get("f4.Brand_3").toString() +"' ) "
The problem is, out of three global variables - f4.brand_1, f4.brand_2, and f4.brand_3 only one can have a value in one iteration, due to which the system throws null pointer exception.
How i resolve this?
Thanks.
This one should work:
"SELECT id FROM Account WHERE Id = '"+globalMap.get("f4.AccountId" ).toString() + "' " + "AND Brand__c IN ('" + globalMap.get("f4.Brand_1") != null ? globalMap.get("f4.Brand_1").toString() : globalMap.get("f4.Brand_2") != null ? globalMap.get("f4.Brand_2").toString() : globalMap.get("f4.Brand_3").toString() + "')"
Hi @TRF , unfortunately, i am still getting a null point exception at tsalesforceinput. Could you please help me understand the query construction - i am actually bit confused with the syntax while using global variables(being from non programming background), using + or double quotes in the query below.
Consider a SOQL (or SQL) query as a string.
This string can be a constant such as "SELECT myField FROM myObject" or it may have variable parts for the condition.
Start by thinking what the request should look like, for example "SELECT myField FROM myObject WHERE myField = 'AAA'".
Here "AAA" is not fixed but is included into a global variable (let say myGlobal).
So, you need to construct the request with a fixed part, completed with the content of a global variable and an other fixed part to finish.
The result should be:
"SELECT myField FROM myObject WHERE myField = '" + (String)globalMap.get("myGlobal") + "'"
Pay attention at the globalMap.get syntax, the variable name is a constant "myGlobal" or contained into an other variable (Country2 for example in your case) which must be known to be used.