IEdmTaskInstance.InstanceGuid returning 0000-0000-0000-0000

Just trying to confirm this behavior on my end. I’m running PDM 2021.

Confirmed issue on my end as well. I even tried the .TaskGUID as well just to see if that’s what it was.

Edit: I forgot to mention this is with 2018 SP5.0

  1. I’m 2021 SP3.0. That’s frustrating. I think it’s three lines of code to fix this. Btw, thanks for the confirmation.

Is it possible the task Instance object is not yet created in the TaskLaunch? Maybe I’m miss-reading the help, but I take it that the TaskInstance object isn’t created until the OnCmd is called.

from: IEdmTaskInstance Interface - 2021 - SOLIDWORKS API Help (swlclb-569354389.us-east-1.elb.amazonaws.com)

An instance of the task is created when the task is launched. This interface is created in EdmCmd::mpoExtra when an add-in calls IEdmAddIn5::OnCmd and has previously registered the hooks,…

edit: I must be misunderstanding because in one place the help says “This interface is created … when and add-in calls OnCmd” Then later it says “After the task launches, IEdmTaskInstance can be used to…” Well, if it can be used after the task is launched (presumably before it is run) then it must be created at launch, not on run? I’m just confused.

1 Like

IEdmTaskInstance is created when the task launches. Same instance gets passed to the machine running the task on EdmCmd_TaskRun.

SOLIDWORKS created an SPR for this.
SPR 1218171 : InstanceGUID Property (IEdmTaskInstance) returning an empty guid 0000-0000-0000-000

1 Like

I’m just curious. What would we use that for? I’m not seeing a place where we can get a task by GUID.

InstanceGUID is useful if you are logging (Catching errors or logging steps) your tasks.