Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Compare Dates in SOAP Connectors

Vedanth-BK
Regular Contributor
Regular Contributor

Hello All,

Could you please help with the below?

I need to compare the date stored in user's cp41 to the current date and take an action based on the result in the CreateAccountJSON specific to SOAP Connector. 

I had raised a forum, and the solution works fine for REST Connector 
link : Solved: Compare Dates in SOAP/REST Connectors - Saviynt Forums - 78980

 Scenario- 
I have stored a date in user cp41 in the format dd-mm-yyyy. 
The condition is if the user cp41 date value is greater than the current date then I need to pass user.cp41 else current date in the format MM-dd-yyyy.
I've tried with the below syntax.

 

 

'+Date.parse(\"MM-dd-yyyy\", user.customproperty41)>(new Date())?user.customproperty41:(new Date().format(\"MM-dd-yyyy\"))+'

 

 

 and get the below error : 

 

 

"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	{urn:com.workday/bsvc}Validation_Fault:<ns1:Validation_Error><ns1:Message>Invalid format for date text=SimpleTemplateScript130$_run_closure1@f626f51 on attr Event Effective Date</ns1:Message><ns1:Detail_Message>Invalid format for date text=!**! on attr Event Effective Date. Cause: com.workday.exceptions.ProcessingException: Invalid format for date text=SimpleTemplateScript130$_run_closure1@f626f51 on attr Event Effective Date</ns1:Detail_Message><ns1:Xpath>/wd:Maintain_Contact_Information_for_Person_Event_Request[1]/wd:Maintain_Contact_Information_Data[1]/wd:Effective_Date[1]</ns1:Xpath></ns1:Validation_Error>"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","Validation error occurred. Invalid format for date text=SimpleTemplateScript130$_run_closure1@f626f51 on attr Event Effective Date"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.client.Call.invoke(Call.java:2767)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at org.apache.axis.client.Call.invoke(Call.java:1910)"
"2024-03-19T14:24:06.629+00:00","ecm-worker","","null-24z69","","	at com.saviynt.provisoning.SoapProvisioningService.callSOAPWebService(SoapProvisioningService.groovy:559)"

 

 

Attaching the json

 

 

 

[{
		"REQUESTXML": "${user.email != null && user.email != '' ? '<soapenv:Envelope xmlns:soapenv=\"http://#####/soap/envelope/\" xmlns:bsvc=\"urn:com.workday/bsvc\"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand=\"1\" xmlns:wsse=\"http://##########/wss/2004/01/oasis-####-wss-####\" xmlns:wsu=\"http://##########/wss/2004/01/oasis-####-wss###########\"> <wsse:UsernameToken> <wsse:Username>'+USERNAME+'</wsse:Username> <wsse:Password Type=\"http://##########/wss/2004/01/oasis-####-wss-username-token-profile-1.0#PasswordText\">'+PASSWORD+'</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body><bsvc:Maintain_Contact_Information_for_Person_Event_Request xmlns:wd=\"urn:com.workday/bsvc\" bsvc:Add_Only=\"true\" bsvc:version=\"v36.0\"> <bsvc:Business_Process_Parameters> <bsvc:Auto_Complete>true</bsvc:Auto_Complete> <bsvc:Run_Now>true</bsvc:Run_Now> </bsvc:Business_Process_Parameters> <bsvc:Maintain_Contact_Information_Data> <bsvc:Worker_Reference> <bsvc:ID bsvc:type=\"'+(user.employeeType == 'Contingent Worker'?('Contingent_Worker_ID') : 'Employee_ID')+'\">'+user?.employeeid+'</bsvc:ID> </bsvc:Worker_Reference> <bsvc:Effective_Date>'+{Date.parse(\"MM-dd-yyyy\", user.customproperty41)>(new Date())?user.customproperty41:(new Date().format(\"MM-dd-yyyy\"));}+'</bsvc:Effective_Date> <bsvc:Worker_Contact_Information_Data> <bsvc:Email_Address_Data bsvc:Delete=\"false\" bsvc:Do_Not_Replace_All=\"true\"> <bsvc:Email_Address>'+user?.email+'</bsvc:Email_Address> <bsvc:Usage_Data bsvc:Public=\"true\"> <bsvc:Type_Data bsvc:Primary=\"true\"> <bsvc:Type_Reference> <bsvc:ID bsvc:type=\"Communication_Usage_Type_ID\">WORK</bsvc:ID> </bsvc:Type_Reference> </bsvc:Type_Data> <bsvc:Comments>A</bsvc:Comments> </bsvc:Usage_Data> </bsvc:Email_Address_Data> </bsvc:Worker_Contact_Information_Data> </bsvc:Maintain_Contact_Information_Data></bsvc:Maintain_Contact_Information_for_Person_Event_Request></soapenv:Body> </soapenv:Envelope>' : ''}"
	}
]

 

 

Thank you
Vedanth B.K
4 REPLIES 4

rushikeshvartak
All-Star
All-Star

[
{
"REQUESTXML": "${user.email != null && user.email != '' ? '<soapenv:Envelope xmlns:soapenv=\"http://#####/soap/envelope/\" xmlns:bsvc=\"urn:com.workday/bsvc\"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand=\"1\" xmlns:wsse=\"http://##########/wss/2004/01/oasis-####-wss-####\" xmlns:wsu=\"http://##########/wss/2004/01/oasis-####-wss###########\"> <wsse:UsernameToken> <wsse:Username>'+USERNAME+'</wsse:Username> <wsse:Password Type=\"http://##########/wss/2004/01/oasis-####-wss-username-token-profile-1.0#PasswordText\">'+PASSWORD+'</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body><bsvc:Maintain_Contact_Information_for_Person_Event_Request xmlns:wd=\"urn:com.workday/bsvc\" bsvc:Add_Only=\"true\" bsvc:version=\"v36.0\"> <bsvc:Business_Process_Parameters> <bsvc:Auto_Complete>true</bsvc:Auto_Complete> <bsvc:Run_Now>true</bsvc:Run_Now> </bsvc:Business_Process_Parameters> <bsvc:Maintain_Contact_Information_Data> <bsvc:Worker_Reference> <bsvc:ID bsvc:type=\"'+(user.employeeType == 'Contingent Worker'?('Contingent_Worker_ID') : 'Employee_ID')+'\">'+user?.employeeid+'</bsvc:ID> </bsvc:Worker_Reference> <bsvc:Effective_Date>'+ (Date.parse(\"MM-dd-yyyy\", user.customproperty41) > new Date() ? user.customproperty41 : (new Date().toISOString().slice(0, 10))) +'</bsvc:Effective_Date> <bsvc:Worker_Contact_Information_Data> <bsvc:Email_Address_Data bsvc:Delete=\"false\" bsvc:Do_Not_Replace_All=\"true\"> <bsvc:Email_Address>'+user?.email+'</bsvc:Email_Address> <bsvc:Usage_Data bsvc:Public=\"true\"> <bsvc:Type_Data bsvc:Primary=\"true\"> <bsvc:Type_Reference> <bsvc:ID bsvc:type=\"Communication_Usage_Type_ID\">WORK</bsvc:ID> </bsvc:Type_Reference> </bsvc:Type_Data> <bsvc:Comments>A</bsvc:Comments> </bsvc:Usage_Data> </bsvc:Email_Address_Data> </bsvc:Worker_Contact_Information_Data> </bsvc:Maintain_Contact_Information_Data></bsvc:Maintain_Contact_Information_for_Person_Event_Request></soapenv:Body> </soapenv:Envelope>' : ''}"
}
]


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Hi @rushikeshvartak 

Thaks for the response, I tried the above syntax and i got the below error 

VedanthBK_0-1715071917905.png

 

Thank you
Vedanth B.K

vivek9237
Regular Contributor
Regular Contributor

@Vedanth-BK 
Can you try with this?

 

[{
		"REQUESTXML": "${user.email != null && user.email != '' ? '<soapenv:Envelope xmlns:soapenv=\"http://#####/soap/envelope/\" xmlns:bsvc=\"urn:com.workday/bsvc\"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand=\"1\" xmlns:wsse=\"http://##########/wss/2004/01/oasis-####-wss-####\" xmlns:wsu=\"http://##########/wss/2004/01/oasis-####-wss###########\"> <wsse:UsernameToken> <wsse:Username>'+USERNAME+'</wsse:Username> <wsse:Password Type=\"http://##########/wss/2004/01/oasis-####-wss-username-token-profile-1.0#PasswordText\">'+PASSWORD+'</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body><bsvc:Maintain_Contact_Information_for_Person_Event_Request xmlns:wd=\"urn:com.workday/bsvc\" bsvc:Add_Only=\"true\" bsvc:version=\"v36.0\"> <bsvc:Business_Process_Parameters> <bsvc:Auto_Complete>true</bsvc:Auto_Complete> <bsvc:Run_Now>true</bsvc:Run_Now> </bsvc:Business_Process_Parameters> <bsvc:Maintain_Contact_Information_Data> <bsvc:Worker_Reference> <bsvc:ID bsvc:type=\"'+(user?.employeeType == 'Contingent Worker' ? 'Contingent_Worker_ID' : 'Employee_ID')+'\">'+user?.employeeid+'</bsvc:ID> </bsvc:Worker_Reference> <bsvc:Effective_Date>'+ ((Date.parse('MM-dd-yyyy', user?.customproperty41)>(new Date())) ? user?.customproperty41:(new Date().format('MM-dd-yyyy')))+'</bsvc:Effective_Date> <bsvc:Worker_Contact_Information_Data> <bsvc:Email_Address_Data bsvc:Delete=\"false\" bsvc:Do_Not_Replace_All=\"true\"> <bsvc:Email_Address>'+user?.email+'</bsvc:Email_Address> <bsvc:Usage_Data bsvc:Public=\"true\"> <bsvc:Type_Data bsvc:Primary=\"true\"> <bsvc:Type_Reference> <bsvc:ID bsvc:type=\"Communication_Usage_Type_ID\">WORK</bsvc:ID> </bsvc:Type_Reference> </bsvc:Type_Data> <bsvc:Comments>A</bsvc:Comments> </bsvc:Usage_Data> </bsvc:Email_Address_Data> </bsvc:Worker_Contact_Information_Data> </bsvc:Maintain_Contact_Information_Data></bsvc:Maintain_Contact_Information_for_Person_Event_Request></soapenv:Body> </soapenv:Envelope>' : ''}"
	}
]

 

Using the above JSON, I was able to generate  this using sample values - 

 

<soapenv:Envelope
	xmlns:soapenv="http://#####/soap/envelope/"
	xmlns:bsvc="urn:com.workday/bsvc">
	<soapenv:Header>
		<wsse:Security soapenv:mustUnderstand="1"
			xmlns:wsse="http://##########/wss/2004/01/oasis-####-wss-####"
			xmlns:wsu="http://##########/wss/2004/01/oasis-####-wss###########">
			<wsse:UsernameToken>
				<wsse:Username>testUserName</wsse:Username>
				<wsse:Password Type="http://##########/wss/2004/01/oasis-####-wss-username-token-profile-1.0#PasswordText">somepassword</wsse:Password>
			</wsse:UsernameToken>
		</wsse:Security>
	</soapenv:Header>
	<soapenv:Body>
		<bsvc:Maintain_Contact_Information_for_Person_Event_Request
			xmlns:wd="urn:com.workday/bsvc" bsvc:Add_Only="true" bsvc:version="v36.0">
			<bsvc:Business_Process_Parameters>
				<bsvc:Auto_Complete>true</bsvc:Auto_Complete>
				<bsvc:Run_Now>true</bsvc:Run_Now>
			</bsvc:Business_Process_Parameters>
			<bsvc:Maintain_Contact_Information_Data>
				<bsvc:Worker_Reference>
					<bsvc:ID bsvc:type="Employee_ID">null</bsvc:ID>
				</bsvc:Worker_Reference>
				<bsvc:Effective_Date>05-15-2024</bsvc:Effective_Date>
				<bsvc:Worker_Contact_Information_Data>
					<bsvc:Email_Address_Data bsvc:Delete="false" bsvc:Do_Not_Replace_All="true">
						<bsvc:Email_Address>test@test.com</bsvc:Email_Address>
						<bsvc:Usage_Data bsvc:Public="true">
							<bsvc:Type_Data bsvc:Primary="true">
								<bsvc:Type_Reference>
									<bsvc:ID bsvc:type="Communication_Usage_Type_ID">WORK</bsvc:ID>
								</bsvc:Type_Reference>
							</bsvc:Type_Data>
							<bsvc:Comments>A</bsvc:Comments>
						</bsvc:Usage_Data>
					</bsvc:Email_Address_Data>
				</bsvc:Worker_Contact_Information_Data>
			</bsvc:Maintain_Contact_Information_Data>
		</bsvc:Maintain_Contact_Information_for_Person_Event_Request>
	</soapenv:Body>
</soapenv:Envelope>

 



Regards,

Vivek Mohanty


If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

Hi @Vedanth-BK 

Could you please check and confirm if this works with above JSON.

Regards,

Dhruv Sharma