hi ,
i want to call few action items in jobs to validate some data and then run the jobs using the jobs scheduler
but I'm getting some errors
Below is the sample code I'm using
from SiemplifyJob import SiemplifyJob
from SiemplifyAction import SiemplifyAction
INTEGRATION_NAME = "Automations"
SCRIPT_NAME = "JobTemplate"
def main():
siemplify = SiemplifyJob()
siemplify.LOGGER.info("A - ".format(siemplify))
sm = SiemplifyAction()
siemplify.LOGGER.info("B - ".format(sm))
siemplify.script_name = SCRIPT_NAME # In order to use the SiemplifyLogger, you must assign a name to the script
try:
get_case_creation_time = sm.get_case_context_property('caseCreatedTime')
print(get_case_creation_time)
# .... CUSTOM LOGIC HERE....
# .... CUSTOM LOGIC HERE....
# .... CUSTOM LOGIC HERE....
except Exception as e:
siemplify.LOGGER.error("General error performing Job {}".format(SCRIPT_NAME))
siemplify.LOGGER.exception(e)
raise
siemplify.end_script()
if __name__ == "__main__":
main()
and below is the error I'm getting
[2024-06-12,08:42:10,000 INFO] A -
Traceback (most recent call last):
File "/opt/siemplify/siemplify_server/bin/Scripting/PythonSDK/IntegrationsVirtualEnvironment/#/Automations_V24.0/ayhheqp2.u01/iwewa3jm.3dj.py", line 33, in <module>
main()
File "/opt/siemplify/siemplify_server/bin/Scripting/PythonSDK/IntegrationsVirtualEnvironment/#/Automations_V24.0/ayhheqp2.u01/iwewa3jm.3dj.py", line 11, in main
sm = SiemplifyAction()
File "/opt/siemplify/siemplify_server/bin/Scripting/PythonSDK/SiemplifyAction.py", line 36, in __init__
self.context_data = json.loads(raw_context_data.decode("utf-8-sig"))
File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I would appreciate it if anyone could help me to fix this.
Solved! Go to Solution.
You could utilize the API endpoint "/api/external/v1/ide/TestItem" to test actions from a job. Running a test manually will let you capture the request you need to send. You can also read the "debugOutput" and response of the action.
I don't know if SiemplifyAction is made available to Jobs
SiemplifyJob has many of the same calls
Maybe reapproach how you are designing the flow of the job
You could utilize the API endpoint "/api/external/v1/ide/TestItem" to test actions from a job. Running a test manually will let you capture the request you need to send. You can also read the "debugOutput" and response of the action.