Not able to trigger an event from the script

Hi Everyone,

I am trying to generate an event from a script.

I tested the script using Visual Studio its triggering the event but when I tested the same from designer it not triggering any event.

If sapMandant.ALEShortName.Contains("ND2") Then
Dim htParameter = New Dictionary(Of String, Object)(StringComparer.OrdinalIgnoreCase)
Dim UID_DPRProjectionStartInfo As String = Connection.GetSingleProperty("DPRProjectionStartInfo", "UID_DPRProjectionStartInfo", "UID_DPRSystemVariableSet = '" & UID_DPRSystemVariableSet & "' AND UID_DPRProjectionConfig = '" & UID_DPRProjectionConfiguration & "'").ToString()
htParameter.Add("UID_DPRProjectionStartInfo", UID_DPRProjectionStartInfo)
Dim myEntity As IEntity = Session.Source.Get("SAPMANDANT", UID_SapMandant)
Using uow As IUnitOfWork = Session.StartUnitOfWork()
uow.Generate(myEntity, "POSTSYNC_ND2", htParameter)
End Using
End If

Any Idea if I am missing something ?