Exceptions and Requirement

Discussions related to custom development with Select.
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Exceptions and Requirement

Post by sanjay.mittal »

Can somebody provide me an example of adding exceptions and requirements for an order?
Melissa McBerkowitz
Posts: 91
Joined: Wed Sep 10, 2008 3:33 pm
Location: Raleigh, NC
Contact:

Re: Exceptions and Requirement

Post by Melissa McBerkowitz »

Can you post what you have so far and let us know where you're having problems?
Melissa McBerkowitz
VP of Product Strategy, SoftPro
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Exceptions and Requirement

Post by sanjay.mittal »

I don't have much to share. I just want to open an order and then add exceptions and requirements to that order.
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Exceptions and Requirement

Post by sanjay.mittal »

Can you please provide a quick sample?
neetab
Posts: 22
Joined: Wed Apr 17, 2013 3:20 pm

Re: Exceptions and Requirement

Post by neetab »

IOrder order;
dynamic title = order["Title"];
dynamic commitment = title.Commitments[0];
bool areRequirements = true;
dynamic reqExp = areRequirements ? order.CreateNew("Requirement"): order.CreateNew("Exception");

if (areRequirements)
{
commitment.Requirements.Add(reqExp);
}
else
{
commitment.Exceptions.Add(reqExp);
}
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Exceptions and Requirement

Post by sanjay.mittal »

This is the error I get when I try to add an exception to the order.

"System.MemberAccessException: Cannot access member. at Microsoft.VisualBasic.CompilerServices.Symbols.Container.InvokeMethod(Method TargetProcedure, Object[] Arguments, Boolean[] CopyBack, BindingFlags Flags) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.CallMethod(Container BaseReference, String MethodName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, BindingFlags InvocationFlags, Boolean ReportErrors, ResolutionFailure& Failure) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.ObjectLateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn) at ERprjNA2SPS_CPutData.ERmodNA2SPS_CPutData.UpdateOrderReqEx(IOrder&
spsOrder, Object& spsCommitment, XmlDocument& xmlMessage, String strType) in C:\SVO\SmartServiceBus\Adapters\NextAce\ERprjNA2SPS_CPutData\ERprjNA2SPS_CPutData\ERmodNA2SPS_CPutData.vb:line 275"


Here is the piece of code, I am using.
Dim ospsReqEx
ospsReqEx = DirectCast(spsOrder, IOrder).CreateNew("Exception")
ospsReqEx.text = strDesc
ospsReqEx.Code = GetNode(xmlNode, "Code", "")

spsCommitment.Exceptions.add(ospsReqEx)
neetab
Posts: 22
Joined: Wed Apr 17, 2013 3:20 pm

Re: Exceptions and Requirement

Post by neetab »

In the code you have below, it should be ".Text"

try...
ospsReqEx.Text = strDesc
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Exceptions and Requirement

Post by sanjay.mittal »

That didn't work. I even try after removing that line, I am still getting the same error message.
neetab
Posts: 22
Joined: Wed Apr 17, 2013 3:20 pm

Re: Exceptions and Requirement

Post by neetab »

Can you share the code where you are getting this error message? line 275?

C:\SVO\SmartServiceBus\Adapters\NextAce\ERprjNA2SPS_CPutData\ERprjNA2SPS_CPutData\ERmodNA2SPS_CPutData.vb:line 275"
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Exceptions and Requirement

Post by sanjay.mittal »

When I add the requirement to the order.

spsCommitment.Exceptions.add(ospsReqEx)

Let me know if you need more information.
Post Reply