"You do not have access to order xxx" when using GetOrder()

Discussions related to order tracking development with the ProForm module.

Moderator: Phil Barton

chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

"You do not have access to order xxx" when using GetOrder()

Post by chris.brady »

I am getting the folowing error when attempting to use the GetOrder method through the API:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: You do not have access to open order TX-004321.
at SoftPro.OrderTracking.Client.OrderTracking.OpenOrder(Guid id, Boolean readOnly, Boolean isTemplate)
at SoftPro.OrderTracking.Client.OrderTracking.GetOrderOrTemplate(OrderQuerySpec spec, Boolean readOnly, Boolean isTemplate)
at SoftPro.OrderTracking.Client.OrderTracking.GetOrder(OrderQuerySpec spec, Boolean readOnly)
at LoadHUDDataDll.LoadHUDDataDllClass.GetOrderFromSoftPro(String strRequesterInfo, String strOrderNumber, String strIPAddress) in C:\\pmavs3tfsweb\\PGPTitle\\SoftPro API Interface\\LoadHUDData\\LoadHUDDataDll\\LoadHUDDataDllClass.cs:line 156
--- End of inner exception stack trace ---

I thought the API had full read/write access. We're using the default admin account.
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Re: "You do not have access to order xxx" when using GetOrde

Post by chris.brady »

Ok, after researching further, it looks like this might be an issue with the profile not matching the profile on the order. I read the documentation in the SDK and it seems like there should be a way to do this programatically, but I am not having any luck. Any guidance would be appreciated.
john.morton
Posts: 89
Joined: Wed Nov 16, 2011 11:51 am

Re: "You do not have access to order xxx" when using GetOrde

Post by john.morton »

Yes, this is the error you'll get if the profile you're using doesn't have access to that order. What other developers have done in the past is make some specific users for the API, which have access to all (or at least most) profiles.
mrisen
Posts: 98
Joined: Wed Jul 25, 2012 7:01 pm

Re: "You do not have access to order xxx" when using GetOrde

Post by mrisen »

I'm getting this error as well. As far as I can tell, we use the admin account to make the programmatical call and it is a member of all the profiles. The order in question is associated with the /Default Ownership profile. However, I still get this error. Would it matter if the order was created on one machine and attempted to update from another?
john.morton
Posts: 89
Joined: Wed Nov 16, 2011 11:51 am

Re: "You do not have access to order xxx" when using GetOrde

Post by john.morton »

When you log in through the API, it's going to use the accounts "default" profile. So, you might need to have separate accounts available for the API to use based on which profile's orders you want to manipulate.
mrisen
Posts: 98
Joined: Wed Jul 25, 2012 7:01 pm

Re: "You do not have access to order xxx" when using GetOrde

Post by mrisen »

Ok, this one problem has reappeared and I'm not sure why. It happened while I was on vacation.

I have a test that creates the order in SoftPro and then attempts to update the order in SoftPro. The create is successful and I can see the order in the SoftPro DB and the OwningProfileID (the profile GUID) is the same as the one I am supplying on create and update. I am still getting the "You do not have access to open order X" message.

Any ideas?
john.morton
Posts: 89
Joined: Wed Nov 16, 2011 11:51 am

Re: "You do not have access to order xxx" when using GetOrde

Post by john.morton »

Please see thread:
viewtopic.php?f=6&t=336&p=1608&hilit=ow ... 73fb#p1608

Unfortunately, this is a known issue. What we've recommended in the past is to have different users available for the API to use when dealing with different profiles. In other words, if you're going to make an Order under ProfileA, then log in with a user who's default profile is ProfileA before making the Order.
mrisen
Posts: 98
Joined: Wed Jul 25, 2012 7:01 pm

Re: "You do not have access to order xxx" when using GetOrde

Post by mrisen »

Ok, I'm clearly missing some pieces here and I need some clarification.

I can see in the SoftPro database that an order is associated with a profile, not a login.
I can see in the code that I am specifying a profile, not a login.
I can see in IIS that the code invoked is running under login credentials X
I can see in SoftPro client that X is not in the list of users

However, in the thread that you referred to, it appears that the login is significant. Is there someplace in the database where there is a relationship between login and profile or profile and rights?
john.morton
Posts: 89
Joined: Wed Nov 16, 2011 11:51 am

Re: "You do not have access to order xxx" when using GetOrde

Post by john.morton »

It's a matter of how the API is choosing which order number manager to use. The natural inclination would have you think that it would use the number manager associated with the profile that owns the order you're making. This isn't the case though. It appears to be using the Order Number Manager associated with the default profile of the account you're using to log into the API with. So, even though you're creating the Order with the correct owning profile, that's not being considered when deciding how to name the order... It's all about the default profile for the user you're using to get your SelectServer with.
mrisen
Posts: 98
Joined: Wed Jul 25, 2012 7:01 pm

Re: "You do not have access to order xxx" when using GetOrde

Post by mrisen »

I can see in the database the owning profile on the order. If I use this profile to manipulate the order, shouldn't it succeed?
Post Reply