Id# and LastId# database fields
-
- Posts: 18
- Joined: Sun Apr 26, 2015 5:04 pm
Id# and LastId# database fields
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?
-
- Posts: 91
- Joined: Wed Sep 10, 2008 3:33 pm
- Location: Raleigh, NC
- Contact:
Re: Id# and LastId# database fields
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
VP of Product Strategy, SoftPro
-
- Posts: 18
- Joined: Sun Apr 26, 2015 5:04 pm
Re: Id# and LastId# database fields
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.
I searched the SDK help doc, but I couldn't find a way to access OrderTask/RequestedOrderTask.
-
- Posts: 411
- Joined: Thu Sep 11, 2008 11:35 am
- Location: Raleigh, NC, USA
- Contact:
Re: Id# and LastId# database fields
This thread should point you in the right direction.
viewtopic.php?f=19&t=781&p=3343&hilit=Tasks#p3343
viewtopic.php?f=19&t=781&p=3343&hilit=Tasks#p3343
John Morris
Sr. Software Architect
SoftPro
Sr. Software Architect
SoftPro
-
- Posts: 18
- Joined: Sun Apr 26, 2015 5:04 pm
Re: Id# and LastId# database fields
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.
Thanks.
-
- Posts: 411
- Joined: Thu Sep 11, 2008 11:35 am
- Location: Raleigh, NC, USA
- Contact:
Re: Id# and LastId# database fields
Please post your code sample, along with the exception call stack.
John Morris
Sr. Software Architect
SoftPro
Sr. Software Architect
SoftPro
-
- Posts: 18
- Joined: Sun Apr 26, 2015 5:04 pm
Re: Id# and LastId# database fields
//--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);
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);
-
- Posts: 411
- Joined: Thu Sep 11, 2008 11:35 am
- Location: Raleigh, NC, USA
- Contact:
Re: Id# and LastId# database fields
Add the task to the "Tasks" collection, not the "ChecklistTasks". Your task will show up correctly.
John Morris
Sr. Software Architect
SoftPro
Sr. Software Architect
SoftPro
-
- Posts: 18
- Joined: Sun Apr 26, 2015 5:04 pm
Re: Id# and LastId# database fields
I am getting same error when I tried to add to tasks collection.