Resolved! Script mentioned is for creating the assessment record but it is only updating the existing record.
Previously it was creating the new assessment instance record and users were able to give the survey , now when we trigger this actions it is updating the old assessment instance record based on users (metric type, userID) matches and updates it. Ne...