Page 1 of 3

Document History

Posted: Wed Mar 16, 2022 1:52 am
by ngillet
For some user when they drag and drop a document under attachment tab in an order that document also showed in document history tab but when I added documents in attachment it does not go under Document History tab.
I also find that some document source is "Attached" and some source is "Published" could you please explain how we can get these.

Re: Document History

Posted: Wed Mar 16, 2022 2:37 pm
by BobRichards
If a document is in the Attachment folders as "Published", then it was generated by selecting a document in the "Document Selection" dialog (in an open order, select "Documents" in ribbon at top). The user selected the "Publish" action for the document. Only documents that are generated then distributed in the "Document Selection" screen will appear in the "Document History".

If the document is in the Attachment folders, then it was added by manually adding the file (by right clicking on a folder) or by dragging the file into the file explorer area of the screen.

Re: Document History

Posted: Wed Mar 23, 2022 7:54 am
by ngillet
Could you please provide the database mapping of "Attachment" tab of SoftPro

Currently in our project if any new document goes to Document History tab then a information email goes for that newly added document to their corresponding users ,but if someone drag and drop the document in "Attachment" folder then they are not able to receive the emails because that document do not go to Document History because its source is attached

Now we want emails to be send for newly added document in "Attachment" folder but emails should not send for the documents which are automatic added in "Attachment" folder when a order is created

Please kindly suggest the way in which we can do this task

Re: Document History

Posted: Wed Mar 23, 2022 10:45 am
by BobRichards
There is no database mapping from orders to attachments since all attachments are written to the blob database. The indexing information for the attachments is only in the order itself and not in SQL.

However, you can write an Automation Snippet that takes action when a file is "Attached" to the order by the user (Document is attached). In the snippet, you can do actions that are coded in Python but interact on a low level (think C# API interface) to do anything you want. I'm sorry but you would have to write the code yourself since we don't provide a user accessible email utility in Select but it is doable in .NET libraries.

Please be aware that working with snippets can be difficult since there is no debug IDE. If you want to see about SoftPro writing the snippet, please talk to the manager of the Custom Applications department - Elliott Potts (Elliott.Potts@softprocorp.com).

Take a look at the Automation Snippets forum for some ideas of its capability.

Re: Document History

Posted: Mon Apr 04, 2022 8:55 am
by ngillet
Potts has share SDK with us for that I installed vs 2015 and then SoftPro Select Client .
So to create a package, SDK is installed,then I select New -> Project from the VS2015 File menu. Under the Visual C# -> SoftPro -> Select node I do not find any "SoftPro Select Server Package".
Why I am not finding this please help me out with this.

And what should be the .Net Framework version .It should be same as our application .Net Framework version??

Re: Document History

Posted: Mon Apr 04, 2022 2:41 pm
by BobRichards
The new Select projects will not build in the displayed .NET version (4.5.2). I can't remember the framework number but it is 4.6.x or 4.7.x. The most recent release of Select required .NET 4.8 and that will require Visual Studio 2019 (among others).

Re: Document History

Posted: Tue Apr 05, 2022 10:53 am
by ngillet
I have written below code for package for AttachmentAdded event:
protected override void OnInitialize()
{
// Listen to the environment started event.
ISelectServerEnvironment environment = GetService<ISelectServerEnvironment>();
environment.Started += SelectServerEnvironment_Started;
}

// This method is called when the server is finished loading packages and services.
private void SelectServerEnvironment_Started(object sender, System.EventArgs e)
{
// Unhook this event as it is no longer needed.
ISelectServerEnvironment environment = GetService<ISelectServerEnvironment>();
environment.Started -= SelectServerEnvironment_Started;

//attachment event
System.EventHandler<SoftPro.OrderTracking.Client.Orders.AttachmentItemEventArgs> attachment
= GetService<System.EventHandler<SoftPro.OrderTracking.Client.Orders.AttachmentItemEventArgs>>();
attachment = new EventHandler<AttachmentItemEventArgs>(Attachment_added);

}

// This method is called when an attachment is added
private void Attachment_added(object sender, AttachmentItemEventArgs e)
{
IAttachmentItem item = e.Item;
System.Guid id = item.ID;
string attachment_name = item.Name;
string path = item.Path;
IAttachmentFolder parent_folder = item.Parent;
System.Collections.Generic.IDictionary<string,string> tag = item.Tags;
}

-----------------------------------------------------------------------------------------------------------------------------------------------------------
How could I debug this code and know what is coming in this item property and write further code

Re: Document History

Posted: Tue Apr 05, 2022 1:39 pm
by BobRichards
You must register for the AttachmentAdded event after you have loaded an order (the IOrder object). You cannot register with Select at the beginning to get ALL AttachmentAdded events to all orders. The pseudocode is as follows:

Code: Select all

    IOrder order = {open an order}
    order.AttachmentAdded += Order_AttachmentAdded;
    ...
}

// Register to receive notification when an attachment has been added.
private static void Order_AttachmentAdded(object sender, AttachmentItemEventArgs e)
{
        IAttachmentItem item = e.Item;
        ....
}

Re: Document History

Posted: Wed Apr 06, 2022 10:21 am
by ngillet
When someone has published the document it goes to Document Histroy tab in SoftPro and is it 100% sure it also goes to Attachment ->folders ?????

I want to hit this " https://api.myventuretrac.ml:8443/escro ... eDocuments" with payload when document is added how could I achieve this?

and one dll is missing I do not find it under SoftPro folder how could I get that?????

please found below the code which I write for attachmentadded event:
using SoftPro.Accounting.Client;
using SoftPro.ClientModel;
using SoftPro.EntityModel.Packaging;
using SoftPro.OrderTracking.Client;
using SoftPro.OrderTracking.Client.Orders;
using SoftPro.Select.Client;
using SoftPro.Select.Service;
using SoftPro.ServerModel;
using System;
using System.Runtime.InteropServices;

namespace ServerPackage1
{
[Guid("026ae76b-5489-447a-bafe-63ca269b69c6")]
partial class MyPackage : Package
{
// This method is called when the package is loaded by the server.
protected override void OnInitialize()
{
// Listen to the environment started event.
ISelectServerEnvironment environment = GetService<ISelectServerEnvironment>();
environment.Started += SelectServerEnvironment_Started;
}

// This method is called when the server is finished loading packages and services.
private void SelectServerEnvironment_Started(object sender, System.EventArgs e)
{
// Unhook this event as it is no longer needed.
ISelectServerEnvironment environment = GetService<ISelectServerEnvironment>();
environment.Started -= SelectServerEnvironment_Started;

IOrder order = GetService<IOrderStore>();
order.AttachmentAdded += Order_AttachmentAdded;
//This below url is api of my project which should be hit when some document is added
//how this url hit with payload data?????????????????
https://api.myventuretrac.ml:8443/escro ... eDocuments
}

// This method is called when an attachment is added
private void Order_AttachmentAdded(object sender, AttachmentItemEventArgs e)
{
IAttachmentItem item = e.Item;
System.Guid id = item.ID;
string attachment_name = item.Name;
string path = item.Path;
IAttachmentFolder parent_folder = item.Parent;
System.Collections.Generic.IDictionary<string,string> tag = item.Tags;
}
}
}

Re: Document History

Posted: Thu Apr 07, 2022 10:38 am
by ngillet
1)I have installed the SoftPro Select Server but I do not find the missing dlls.

2)In my package I have to made a api call when a document is added to order and send payload data which contain {ordenumber ,documents name}

3)I have write my question in bewteen code also

4)How could I store this document added information in a table in database?

private void SelectServerEnvironment_Started(object sender, System.EventArgs e)
{
// Unhook this event as it is no longer needed.
ISelectServerEnvironment environment = GetService<ISelectServerEnvironment>();
environment.Started -= SelectServerEnvironment_Started;

IOrder order = GetService<IOrderStore>();
order.AttachmentAdded += Order_AttachmentAdded
}
// This method is called when an attachment is added
private void Order_AttachmentAdded(object sender, AttachmentItemEventArgs e)
{
IAttachmentItem item = e.Item;
System.Guid id = item.ID;/////what is this ID ?
string attachment_name = item.Name;////Is this document name which is added?
string path = item.Path;
IAttachmentFolder parent_folder = item.Parent;
System.Collections.Generic.IDictionary<string,string> tag = item.Tags;
}