Script runner behavior not working in the portal view

in the Agent view the behaviour script is not working fine and autopopulting the values into the respective fields as per the scripts is working fine .
But the same script if we are using it for the portal view its not working as excepted.
Can anyone guide me on this scenario please.