Status rollup

Hi Team, I am trying to automate the statuses between an entity and its respective tasks. for example, if there is a change made in the summary task of that entity, the same should be made to the animation entity status. Below is the code that I wrote for this. But there is no output received for this code. And it doesn’t seem to work. Need help!

import os
import shotgun_api3
import logging

def registerCallbacks(reg):
eventFilter = {‘Entity’:[‘CustonEntity05’],
“Shotgun_task_Change”:“sg_status_list”}
reg.registerCallback(
os.environ[BASE_URL],
os.environ[“SCRIPT_NAME_2”],
os.environ[“SCRIPT_KEY_2”],
animationrollup,
eventFilter,
None
)
reg.logger.setLevel(logging.DEBUG)
def animationrollup(sg,logger,event,args):
if event[‘meta’][‘new_value’] == None:
Entity_type = sg.find(“CustomEntity05”,(“Project”, “is”,{“id”,“is”,221}),
(‘Task_name’,‘is’,‘Animation_Summary’),
(‘step’,‘is’,{‘id’,‘is’,646}),
[“sg_status_list”]
)
batch_updates = [
{“request_type”:“update”,
“entity_type”:“CustomEntity05”,
“data”: {“sg_status_list” : None}
}for CustomEntity05 in Entity_type
if task[‘sg_status_list’] == None
]
sg.batch(batch_updates)

Have you tested this code in a more manual way?
Could you add some logging so you can see what is happening?

Its a bit hard to follow what you are trying to do.

I.e. why are you looking for a new value of “None”?

Hi Ricardo, Thanks for the reply. Disclaimer: I am completely new to scripting and this is like my first script .I am trying to automate the status change of the entity and its corresponding task. For example, Lets assume there are around ten tasks with a summary task associated with a shot. I want to automate the change in the status of the task to change the status of the entity associated. I have set the new value to none because I guessed if a new value is set to None, it will grab whatever status comes to it and change it correspondingly. I am sorry if i were wrong. :sweat_smile: