Id# and LastId# database fields

Discussions related to custom development with Select.
harshapatil
Posts: 18
Joined: Sun Apr 26, 2015 5:04 pm

Id# and LastId# database fields

Post by harshapatil »

I am writing a script to sync data between SoftPro and GF. What is the logic behind id# and LastId# database fields. If i am manually adding new records (for example a new task in pfm.Task table), what logic/formula I should use to generate these IDs?
Melissa McBerkowitz
Posts: 91
Joined: Wed Sep 10, 2008 3:33 pm
Location: Raleigh, NC
Contact:

Re: Id# and LastId# database fields

Post by Melissa McBerkowitz »

You cannot manually add new records to these database tables directly. The only way to add data into these tables is through the order API.
Melissa McBerkowitz
VP of Product Strategy, SoftPro
harshapatil
Posts: 18
Joined: Sun Apr 26, 2015 5:04 pm

Re: Id# and LastId# database fields

Post by harshapatil »

Will you please provide a example code to add an OrderTask using SDK 4.0.3 (C#)?

I searched the SDK help doc, but I couldn't find a way to access OrderTask/RequestedOrderTask.
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: Id# and LastId# database fields

Post by John Morris »

This thread should point you in the right direction.

viewtopic.php?f=19&t=781&p=3343&hilit=Tasks#p3343
John Morris
Sr. Software Architect
SoftPro
harshapatil
Posts: 18
Joined: Sun Apr 26, 2015 5:04 pm

Re: Id# and LastId# database fields

Post by harshapatil »

I am getting "Cannot access member" when I try to add a new task to existing order. According to viewtopic.php?f=19&t=554&p=2349&hilit=R ... Task#p2349, this might be a permission issue. Will you please tell me where/what permissions I need to add task to existing order. BTW I am using administrator user in my API.

Thanks.
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: Id# and LastId# database fields

Post by John Morris »

Please post your code sample, along with the exception call stack.
John Morris
Sr. Software Architect
SoftPro
harshapatil
Posts: 18
Joined: Sun Apr 26, 2015 5:04 pm

Re: Id# and LastId# database fields

Post by harshapatil »

//--Get Order by number
IOrderStore os = ss.GetService<IOrderStore>();
IOrder O = SoftProUtility.GetSoftProOrderByNumber(ss, "12345678");

//--Create new checlist task
dynamic newtask = O.Order.CreateNew("ChecklistTask");
newtask.Description = "Title Update";
newtask.Status = TaskStatusType.Required;

//--Assign to user
ISecurityManager securityManager = ss.GetService<ISecurityManager>();
ISecurityIdentity AssignedUser = securityManager.Identities.Where(p => p.FullName == "ABC").FirstOrDefault();
newtask.AssignedTo = AssignedUser;

//--Add to order task collection
dynamic requestedTasks = O.Order["ChecklistTasks"];
requestedTasks.Add(newtask);
harshapatil
Posts: 18
Joined: Sun Apr 26, 2015 5:04 pm

Re: Id# and LastId# database fields

Post by harshapatil »

Image
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: Id# and LastId# database fields

Post by John Morris »

Add the task to the "Tasks" collection, not the "ChecklistTasks". Your task will show up correctly.
John Morris
Sr. Software Architect
SoftPro
harshapatil
Posts: 18
Joined: Sun Apr 26, 2015 5:04 pm

Re: Id# and LastId# database fields

Post by harshapatil »

I am getting same error when I tried to add to tasks collection.

Image
Post Reply