Vardhan - Friday, March 8, 2013 5:50 AM:
Hi,
I am trying to Release some parts at a time using an ECO. All the Parts are having Assigned Creator and Designated User selected. So, only these can Release the parts. In the ECO change Coordinator is 'Innovator Admin' and a Team is selected, Once the ECO gets into Planning state 'Team Manager'(Assignment of the Planning Activity) performs the action 'Relase Part' for all Parts. After completing the Action when the Team Manager tries to Vote 'Start Work' getting an error:Object Reference Not set to instance of object.
When I do the actions 'Supersede Part', 'Obsolete Part' ,I' m not getting this error.
Is this because of any Permission issue? Or any other null value I' m trying to call?
Thank You, Vardh.
Eric Domke - Tuesday, April 2, 2013 9:14 PM:
First check: do you have any server methods running on a promotion or vote which might be getting called and generating this error? Second check: do you have any transitions in a life cycle you are dealing with that don't have an allowed identity associated with them? If so, make sure to specify an identity, and the error should go away.
Vardhan - Thursday, April 4, 2013 2:35 AM:
Thanks Eric,
Yeah its because of a server method, the method is working fine but it is throwing the 'Object reference..' error when I run it as 'Run server Method'. Any idea?
Thank you, Vardh
Eric Domke - Friday, April 5, 2013 8:49 AM:
Without seeing the code, it is difficult to say. All I can say with certainty is that (at least under certain circumstances) you are using a variable before it has been assigned a value.
Vardhan - Monday, April 8, 2013 2:14 AM:
Hi Eric, Here is the code, the code sets up the value for Part's 'Assigned Creator' based on the classification type.
Dim innov As Innovator = Me.getInnovator() Dim identity As Item = innov.newItem("Identity", "get")
Dim classification As String = Me.getProperty("classification") Dim owned_by_id As Item = Me.getPropertyItem("owned_by_id")
If classification.Contains("1-Electronics") Then Dim item_elc As Item = Me.NewItem() item_elc.loadAML("<Item type='Identity' action='get' Select='name'>"+"<name Condition='like'>Component Engineering - Electronics</name>" + "</Item>") Dim elc_result As Item = item_elc.Apply()
Me.setPropertyItem("owned_by_id", elc_result)
Else '''other conditions'''
End If
This method is added to Part ItemType with 'OnBeforeAdd' Event.
Thanks, Vardh
Eric Domke - Monday, April 8, 2013 7:52 AM:
If no classification is specified, Me.getProperty("classification") will return Nothing and cause If classification.Contains("1-Electronics") to throw a null reference exception. You can fix this by specifying a default value for classification such as:
Dim classification As String = Me.getProperty("classification", "")
Vardhan - Tuesday, April 9, 2013 4:35 AM:
Thanks Eric, It worked after specifying a default value.