How to make a web service call to Salesforce from jitterbit - web-services

I am new to Jitterbit and i want to update records in salesforce based on a condition but need to do this using a web service.
Using web service i want to get the id of the record from salesforce as a response then that response will be used as a source to other operations.
But i dont know how to make a request call to salesforce using Jitterbit.
Please help me on this.

I don't know if you still need this but here it goes how I'd do it. You might want to create a script and run the operation to SF.
Any operation (that is successful) will be able to return an ID, if you analyze the response object (double click on the Web Service Response object), then on the target panel, expand TARGET:NameOfResponse -> flat -> response.
If you open the response, Jitterbit will open using formula builder and here you will find a script:
<trans>
// This mapping is part of a Salesforce wizard.
// Modifying it may cause the wizard to malfunction.
If(root$transaction.response$body$createResponse$result.success$ == false,
WriteToOperationLog(SumString(root$transaction.response$body$createResponse$result.errors#.message$, ". ", false)))
</trans>
Since this is just another script, you can add a global variable and retrieve the ID ($MyGlobalVariable):
<trans>
// This mapping is part of a Salesforce wizard.
// Modifying it may cause the wizard to malfunction.
If(root$transaction.response$body$createResponse$result.success$ == false,
WriteToOperationLog(SumString(root$transaction.response$body$createResponse$result.errors#.message$, ". ", false))
,
$MyGlobalVariable = root$transaction.response$body$createResponse$result.id$)
</trans>
So in script, you reference the ID after running the operation:
<trans>
RunOperation("<TAG>Operations/TheOperation</TAG>");
WriteToOperationLog($MyGlobalVariable);
</trans>

Related

How to Clear a pickup list value in Salesforce while updating from AWS APPFlow

We are trying to push data into a custom SalesForce object using AWS AppFlow, the object is a multi select pickup list and expects 0-* items. The issue is once the value is set through AppFlow the value is not cleared when the property is set to null again. We are mapping the field to an Empty String when we want to clear it.
We have tried setting an Empty XML Tag but sadly that doesn't clear the value in Salesforce
Do you know which Salesforce API this uses behind the scenes?
In SOAP API you pass special fieldsToNull tag. See https://ideas.salesforce.com/s/idea/a0B8W00000GdjWwUAJ/allow-nulls-to-be-passed-as-a-valid-value-via-the-apis?sfdcIFrameOrigin=null and https://developer.salesforce.com/docs/atlas.en-us.238.0.api.meta/api/sforce_api_calls_concepts_core_data_objects.htm?q=fieldstonull
In "normal" (synchronous) REST API should be just a null node in JSON
{
"Id" : "001...",
"Description": null
}
And in bulk REST API... depends. If you pass JSON - same as above. If you pass a CSV - use #N/A.

In jmeter I need to send a file path with random file name, how to get that random file name to pass in a request

I am load testing a web application scenario in which:
1.) First I need to upload an excel file it will be parsed and sheets (tabs in excel) loads into a drop-down.
2.)Then selects an option in drop-down and clicks on import button.
3.) After clicking on import a new pop up open with some data loaded in the grid with "update to database" button. Now clicked on the update to database button.
This is my scenario of load test here I need to load test "import" and "update to database" requests
In this scenario 4 requests works.
In point 1: servicename url is: /xxx/xxx/uploadLoader.aspx
in params are: 2 viewstates, button, appuser, company, filename (with multi-part data)
response: it returns HTML of file upload control
Point 2 using 2 requests:
a) service url is: /xxxx/xxxx.asmx/updateImportSubTableFormat
in params:
{"as_connstring":["GET"],"alist_import":[{"__type":"ApplecartDS.DataLib.ImportTableMain","rowstate":"OLD","tableno":"019","oldtableno":"019","formatid":"I0000012","oldformatid":"I0000012","columnname":"pay_billrefno","oldcolumnname":"","columndesc":"Bill No","aormdesc":"Actual","excelcolumnname":"D","excelcolumnno":"3","excelcolumnnameadd1":"","excelcolumnnoadd1":-1,"excelcolumnnameadd2":"","excelcolumnnoadd2":-1,"serialno":"1","oldserialno":2,"formatname":"","startingrowno":0,"endingrowno":0,"keycolumn":"","keycolumndesc":"","payiddesc":null,"attributetype":"","paytype":"A",".............**some more output data here**.................... 1,"excelcolumnnameadd2":"","excelcolumnnoadd2":-1,"serialno":"3","oldserialno":3,"formatname":"","startingrowno":0,"endingrowno":0,"keycolumn":"","keycolumndesc":"","payiddesc":null,"attributetype":"","paytype":"A",""provision_actual":"P","dsexecstatus":"","dsmsg":"","slno":0,"as_fromatid":"I0000012","ai_xlcolumnname":"A","ai_xlcolumnno":"1","ai_startrow":"2","ai_endrow":0,"ai_header":"1","as_payid":"MEDRE","as_leaveid":"MEDRE","as_wfdcolname":"","ai_wfdcolno":0,"as_arrcolname":"","ai_arrcolno":0,"as_transafertype":"A"}
response:
{"d":[{"__type":"ApplecartDS.DataLib.ImportTableMain","rowstate":"OLD","tableno":"","oldtableno":"","formatid":"","oldformatid":"","columnname":"","oldcolumnname":"","columndesc":"","aormdesc":"","excelcolumnname":"","excelcolumnno":0,"excelcolumnnameadd1":"","excelcolumnnoadd1":-1,"excelcolumnnameadd2":"","excelcolumnnoadd2":-1,"serialno":0,"oldserialno":0,"formatname":"","startingrowno":0,"endingrowno":0,.............**some more output data here**...................."","valuefrom":"E","default_value":"","aorm":"A","benefitsid":"","licpayid":"","createmaster":"","allowzero":"N","groupid":"","groupdesc":"","reimbpayid":"","provision_actual":"P","dsexecstatus":"","dsmsg":"","slno":0}]}
Note: If I hit same request wit same in parmas then it returns correct same response.
b) service url is: /AAA/AAA.asmx/importXLData
in params:
{"as_connstring":["GET"],"as_filename":"C:\\Websites\\xxxx\\xxxx\\admin\\001\\admin115.248.100.6825520164659134Import_Template.xlsx","ai_header":2,"as_tablename":"rm_claimsmain","as_sheetname":"'Reim claim$'","as_tableno":"019","as_fromatid":"I0000012","as_creditperiodid":"","isUpdate":false,"isupdatemonattribute":false,"alistUpdatedata":[],"as_excelfilepath":"C:\\Websites\\xxxx\\xxxx\\admin\\001\\admin115.248.100.6825520164659134Import_Template.xlsx"}
response
{"d":[{"__type":"ApplecartDS.DataLib.ExcelDataImport","CValues1":"","CValues2":"","CValues3":"","CValues4":"","CValues5":"","CValues6":"","CValues7":"","CValues8":"",..........**very long out put data here**.......
,"NValues50":0,"NValues51":0,3":0,"IValues4":0,"rowmodify":"N","rowstate":"OLD","dsexecstatus":null,"dsmsg":""}]}
Note: But if I hit the same request again then it displays response as below that are different from above response (first-time response). Because the file name changes every time in case of the manual but I am not able to get the new file name to pass it in JMeter request.
second-time response:
{"d":[{"__type":"ApplecartDS.DataLib.ExcelDataImport","CValues1":"","CValues2":"","CValues3":"","CValues4":"","CValues5":"","CVal","CValues17":"","CValues18":"","CValues19":................................. dsexecstatus":"FAIL","dsmsg":"Exception : System.Data.OleDb.OleDbException (0x80004005): The Microsoft Office Access database engine could not find the object \u0027C:\\xxxx\\xxxx\\xxx\\admin\\001\\admin115.248.100.6825520165121629Import_Template_test_case_9May2016.xlsx\u0027. Make sure the object exists and that you spell its name and the path name correctly.
point 3 is using 1 request
service url: /xxxx/xxxx.asmx/importXLData
in params
{"as_connstring":["GET"],"as_filename":"C:\\xxxx\\xxxx\\temp\\admin\\001\\admin115.248.100.682552016571324rm_claimsmain.xml;C:\\Websites\\cPayv8html\\temp\\admin\\001\\admin115.248.100.682552016571324rm_cliams.xml","ai_header":"1","as_tablename":"rm_claimsmain","as_sheetname":"'Reim claim$'","as_tableno":"019","as_fromatid":"I0000012","as_creditperiodid":"","isUpdate":true,"isupdatemonattribute":false,"alistUpdatedata":[{"__type":"ApplecartDS.DataLib.ExcelDataImport","CValues1":"Employee No;C;30;em_empno","CValues2":"Bill No;C;30;","CValues3":"Bill Date;D;30;","CVal/Date(-62135596800000)\/"..........**some more in data**..........,"DValues10":"\/Date(-62135596800000)\/","ls_msg1":"5","ls_msg2":"C:\\xxxx\\xxxx\\xx\\admin\\001\\admin115.248.100.682552016571324rm_claimsmain.xml;C:\\xxxx\\xxx\\xx\\admin\\001\\admin115.248.100.682552016571324rm_cliams.xml","ls_msg3":"","ls_msg4":"","NValues1":0,"NV4":0,"rowmodify":"N","rowstate":"OLD","dsexecstatus":null,"dsmsg":""}],"as_excelfilepath":"C:\\xxxx\\xxxx\\xxx\\admin\\001\\admin115.248.100.6825520164659134Import_Template_test_case_9May2016.xlsx"}
response
{"d":[{"__type":"ApplecartDS.DataLib.ExcelDataImport","CValues1":"","CValues2":"","CValues3":"","CValues4":"","CValues5":"","CValues6":"","CValues7":"","CValues8":"","CValues9":"","CValues10":"","CValues11":"","CValues12":"","CValues13":"","CValues14":"","CValues15":"","CValues16":"","CValues17":"","CValues18":"","................................ "rowmodify":"N","rowstate":"OLD","dsexecstatus":"SUCCESS","dsmsg":"Update to Database success ! New Rows added :0 \u003c\u003e Rows Updated : 49"}]}
If I hit same request again then second time response is:
......................"dsexecstatus":"FAIL","dsmsg":"Exception : Could not find file \u0027C:\\Websites\\cPayv8html\\temp\\admin\\001\\admin115.248.100.682552016525264rm_claimsmain.xml\u0027."}]}
My issue is in second-time response it is not showing correct response as the file name is changing randomly and I am not able to trace it to pass changed file path to the request.
Is there any way to handle it? Please help me out, how can I load test it with an authentic response.
${__RandomString(6,a12zeczclk, MYVAR)}
will return a random string of 6 characters picked from a12zeczclk set and store the result in MYVAR, MYVAR will contain string like 2z22ak or z11kce, …
see:
http://jmeter.apache.org/usermanual/functions.html#__RandomString
Looking into
Could not find file \u0027C:\Websites\cPayv8html\temp\admin\001\admin115.248.100.682552016525264rm_claimsmain.xml\u0027.
It seems that when you upload the file, it's being stored somewhere in a temporary location and when the file is imported into the database - it's deleted. So it's classic "correlation" example where you need to get a dynamic parameter from previous response and add it to the next request.
I would suggest carefully inspect server responses and to get the temporary filename from there.
As your server responds with JSON I would suggest to use
JSON Path PostProcessor - if you're using JMeter 3.0
JSON Path Extractor - if you're sitting on a previous JMeter version
JSON Path Syntax is very easy, check the following references:
JSONPath - XPath for JSON
JSONPath Online Evaluator
Advanced Usage of the JSON Path Extractor in JMeter

liferay 6.2 addDLFolder fail

I tried to build a webservice for external system to upload documents.
Each user create a unique folder to store the documents himself uploaded.
In order to that,I was thinking to create different folder with unique name.
I looked up API and find a DLFolderLocalServiceUtil.addFolder(parameter list is way too long to type) method.
The param serviceContext is required and I can't seem to find a way to retrieve it.
So, I put NULL instead. After I build and deploy, I call the method which contains addFolder() from client, NullPointerException occurs on server and an axis exception occurs on client.
faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException, faultString: java.rmi.RemoteException.
Is it because I put NULL as a parameter instead of an instance of serviceContext?
If so,how can I get the instance of serviceContext? If I can not, where else could be the problem?
Here's my paramlist:
DLFolderLocalServiceUtil.addFolder(user.getUserId(), user.getGroupId(), user.getGroupId(), true, 10157, "test", "description", false, null);
You could also give DLAppLocalServiceUtil.addFolder a try.
Similarly, the Service Context is a parameter, but I'm able to create a folder with the following
final Folder folder = DLAppLocalServiceUtil.addFolder(
getThemeDisplay().getUserId(),
getThemeDisplay().getScopeGroupId(),
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
"Folder Name",
"Folder Description",
new ServiceContext());
In my particular use case, I use the ThemeDisplay from the request object to organize my Document Media elements:
(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY)
Note: Also in my particular usage, the user that triggers the folder creation will have elevated permissions, as such permissioning may be an issue for non-admin users.

JItterBit HTTP Endpoint

I am working to set up a HTTP Endpoint in JitterBit, for this end point we have a system that will call this Endpoint and pass parameters through the URL to it.
example...
http://[server]:[server port]/EndPoint?Id={SalesForecID}&Status={updated status in SF}
Would i need to use the Text File, JSON or XML Method for this? Follow up question would be if it is JSON or XML what would the file look like that is uploaded during creating the endpoint. I have tired with no success with the text file version.
any help would be great.
I'm just seeing your question now. You may have found a solution, but this took me a while to figure out, so I'll respond anyway.
To get the passed values, go ahead and create your HTTP Endpoint and add a new operation triggered by it. Then, in your new operation create a script with something like the following:
$SalesForceID = $jitterbit.networking.http.query.Id
$UpdatedStatus = $jitterbit.networking.http.query.Status
You can then use these variables elsewhere in your operation chain.
If you want to use these values to feed into another RESTful web service (i.e. an HTTP Source), you'll have to create a separate transformation operation with the HTTP Source. You'd set that source URL to be: http://mysfapp.com/call?Id=[SalesForceID]&Status=[UpdatedStatus]. I'm not sure why, but you can't have the script that extracts the parameters from the Endpoint and the HTTP Source that uses those in the same operation.
Cheers

Lotus Notes throws NotesException: Database open failed (%1)

I am running a web service from an instance of Salesforce to our client's Lotus Notes server. I am able to get hard-coded content to return, so I feel certain that the connection itself is working as intended.
However, as noted in the subject, I am running into a NotesException. This is being thrown on the last line of the code below (db and path are simply parameters I pass into the function, I am able to view records from the nsf they correspond to):
s = WebServiceBase.getCurrentSession();
Database data = s.getDatabase(db, path);
data.open();
If I try not opening the database, I get an exception that says I need to open the database. We had been developing this web service for a while without ever opening the database or knowing that this was something to concern ourselves with. Obviously something changed, but as my office is full of Salesforce devs and not LN devs, we don't know what.
Any help in tracking down the root cause of this issue would be greatly appreciated.
Edit:
Comments want to know what I meant by hardcoded content. The function returns a 2d String array, so it would be something like:
result[0][0] = "Hello World";
return result;
The Problem is that the db ist not found. So try to change the path from the db.
if your db is in a folder on the server give the path for the folder in java.
Your path variable must have the right format.