How to determine next activity assignee in workflow in tridion - tridion

I am writing eventhandler for determining the workflow activities. I am able to get the currrent activity assignee.
I need to get the next activity assignee(i.e to which group the activity is assigned to).
Inside the TridionActivityDefinitinData for NextActivityDefinitions i find only Title and Idref of the activities.
Please let me know how to find the next possible activities' assignee.

Have a look at this question How to get the Next Activity Details from the FinishActivityEvent Hanlder?, where user978511 answered it there better than I can.
From what I see there, you'll need something like this:
FinishActivityEventArgs.ActivityFinish.NextAssignee
If that is indeed the case, I marked your question as a duplicate from that one.

Hope this helps someone...
Read the Process Definition for the full list of activities:
ProcessDefinitionData pdd = CoreServiceClient.Read(ProcessInstance.ProcessDefinition.IdRef, null) as ProcessDefinitionData;
then you can use your current posostion (not zero based) to index out from the Activitiy Definitions (zero based):
pdd.ActivityDefinitions[(int)ActivityInstance.Position].Assignee.Title
The above will get you the next activity information. If you want previous activities start by subtracting two from the current position and indexing from the Process Instance Activities:
ProcessInstance.Activities[(int)ActivityInstance.Position - 2].FinishMessage
Enjoy

Related

How to capture user comments in watson conversation where we cant define intent

Iam working on small flow in watson conversation.Currently I want to capture the comments given by the user,but Iam not sure what would be the intent or entity to be used if any in this case.
To be more clear,
1.In one dialog node,watson will give some data and ask to provide comments if required
2..If yes .It will ask for comments .Then user will provide some
3.On enter it should go to Thankyou node where it will display some acknowledgement
and jump back to main branch node.
Issue for me here is:
On which condition can I go to Thankyou node after user gives his comment since I cant
give any intent or entity.
Can someone help me with any ideas
If you wish your thanks you node to always execute, and say thanks for our feedback etc, then the easiest condition to add is simply "true" so just add the word true into the trigger / condition element, and the node will always be executed. This is also a great condition to add to any conversation flow as the last default node.

<adlcp:data> & <adlcp:map>element not understandable

I am working on the SCORM 2004 4th edition based LMS, where i am at the initial stage.
Hence, i am reading SCORM based documents.
In the SCORM 2004 4th edition CAM document, i was stuck at the page CAM-3-37, where the element adlcp:data is defined as the container used to define sets of data shared associated with an
activity.
and the child element of adlcp:data i.e; map is defined as
The element is the container used to describe how an activity will utilize a specific
set of shared data.
I thought, I may understand it as I will move forward in the said book.
But, I completed the CAM book and yet i am unable to get it how those two tags work.
And also, let's take an example into the consideration, which is as follows:
<adlcp:data>
<adlcp:map targetID="com.scorm.golfsamples.sequencing.forcedsequential.notesStorage" readSharedData="true" writeSharedData="true"/>
</adlcp:data>
where, readSharedData attribute indicates that
currently available shared data will be utilized by the activity while it is active.
and writeSharedData attribute indicates that
shared data should be persisted (true or false) upon termination ( Terminate(“”)
) of the attempt on the activity.
Here in this case,
i didn't get what this targetID= com.scorm.golfsamples.sequencing.forcedsequential.notesStorage indicates.
i didn't get what is this shared data? and where is it located? what is it actually?
Can anyone help me in understanding the above described elements?
adlcp:data is a way to define space on the LMS to store information that doesn't fit in the CMI data model, or that you want to make accessible across SCOs.
There are 3 pieces to defining this space.
1. adlcp:sharedDataGlobalToSystem attribute on the element, which says whether shared data is available for one attempt or for every attempt (aka is it wiped out each time the learner takes the course).. See CAM-3-27
2. adlcp:data & adlcp:map elements list the space(s) you want made available for that SCO. You define an ID for each storage space, and then add access controls meaning whether or not the SCO can read or write to the storage space. (See CAM-3-37)
Those two set up the LMS storage and behaviors for each SCO in the content package.
The final piece is described in section 4.3 of the RTE book. To access the data storage spaces, you use the SCORM API GetValue and SetValue requests and the data model element adl.data.n.store.
One additional note, since the id order is not necessarily maintained, you will need to loop through the adl.data stores in the SCO and determine which index goes to which ID.
Tom Creightons answer is a very good explanation of the shared buckets implementation.
I am just adding a few pointers we found in our implentation.
The data saved is for the "learner", and can be accessed and set across different SCO's or courses assigned to the learner. Beware though, if you are using SCORM Cloud, Clear GLobals button will clear the data for all courses assigned to the user.
While Tom mentions that adlcp:sharedDataGlobalToSystem is attempt specific, SCORM Cloud support says that it is restricted to course/SCO. I have yet to get clarity on that.
There might be a limit on the number of buckets being saved. I have yet to confirm this and will update this reply shortly.
For those looking for more info on implementation:
Add this to your item (organisation > item) in the manifest:
<adlcp:data>
<adlcp:map targetID="mybucketname" readSharedData="true" writeSharedData="true"/>
</adlcp:data>
JS part (Use your API calls in place of LMSGetValue and LMSSetValue)
var dataBucketsCount = LMSGetValue("adl.data._count");
dataBucketsCount = parseInt(dataBucketsCount);
for (var i=0; i < dataBucketsCount; i++){
if (LMSGetValue("adl.data." + i + ".id") == "mybucketname"){
//do your processing with the data
}
}
I had to search a lot for this and try and fail multiple times until we got this right. So I have added this here, so in future it might help someone.

Call child form programmatically with parameter / filter

I'm creating a customization where on a click of a button, I need to allocate a charge for a particular purchase order / invoice journal.
From the front end, I would accomplish this by following the purchase order life-cycle and invoicing it. I would then go under the invoice tab of the PO, click Invoice Journals -> Charges -> Adjustment . This will open up my desired form where I will select a charges code, charges value, currency and category, and then I will click 'Ok' and have the system take care of the rest of the process.
Form name: MarkupAllocation_VendInvoiceTrans
Parent form Name: VendInvoiceJournal
You can see that the child form gets called with a few parameters such as the invoice number, there obviously needs to be that link. If I go into the AOT under forms, I right click and open up VendInvoiceJournal, but I wouldn't be able to open up MarkupAllocation_VendInvoiceTrans because it requires parameters.
Objective:
A: To open MarkupAllocation_VendInvoiceTrans through code where I manually pass those parameters to link to the parent table. I would provide the invoice number and such. The objective is to skip opening the parent table and manually going into the adjustments. I want to open that form directly and have it link to whichever record I specify.
B: I need to be able to pass a _ChargesValue parameter and have that be pre-populated for me. I don't know if this is possible, so I wanted to ask and confer. Ideally, I should be able to click a button on my custom form, and have MarkupAllocation_VendInvoiceTrans form directly open for a specified invoice, with pre-populated values on the line.
I know I should be tackling this problem one step at a time, so step A is priority number one.
I can open up the parent form with relative ease like so, but I cannot do the same for the child form. Obviously the same time of approach won't work, as I need to specify the relationship of the parent table before I open it.
private void allocateMarkup()
{
Object formRun;
Args args = new Args();
VendInvoiceJour jourTable;
;
select * from jourTable where jourTable.PurchId == 'PO000001191';
args.name(formstr(VendInvoiceJournal));
args.record(jourTable);
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}
How would I be able to do so?
(Side note, I realize this whole form calling could be avoided if do all the transactions programmatically instead of letting the out of the box functionality handle it, but the markup and allocation logic is a beast of it's own and to me seems much more complicated than doing this. If someone has done it this manual way, any help on that would be greatly appreciated as well)
If I read your post right, you just want to open the Charges>Adjustment for a certain invoice. Here is one simple method:
MarkupAdjustment markupAdjustment = new MarkupAdjustment();
markupAdjustment.vendInvoiceJour(VendInvoiceJour::findFromPurchId('PO 120079'));
markupAdjustment.run();

Data initialize is called before Report Start in Active Reports (Data dynamics)

Per Active reports documentation, the Report start is called first and Data initialize. Any reference to Data source inside Report start will invoke Data Initialize event. I am modifying an existing report; and to my surprise the order is reversed. I have an existing logic to get the count of nodes (my datasource is xml) in data initialize event; just because the event firing sequence is reversed, I am getting 0 as count always.
I am using Active reports for .NET 2.0 ( I think the version is 4.*). As I dont have support for the designer, I have the designer xml and code behind.
Please suggest what could force the event sequence to correct order.
There is probably not enough information for us to help you here. We'd need to see the report code at least, but better if you can do some debugging to find out more detail about what specific code you have that is causing the trouble.
I'm actually not sure about event order in this specific case, but to troubleshoot you could try with a new blank report to verify the event order in that case and move over one piece of code at a time to find out which line of code causes the event order to change.

How to get the Next Activity Details from the FinishActivityEvent Hanlder?

I have subscribed WorkflowFinishActivityEvent with TransactionCommitted phase. I am getting the details of the current finished activity like below
Performer of the current finished activity
foreach(var performer in currentactivity.Performers)
{
string Performeroftheactivity= performer .title.tostring();
}
Finish Message of the current finished activity
string finishmessage = currentactivity.FinishMessage.Tostring()
My Question:
I would like to take the Next assigned activity title and assignee from the current finished activity event.
Could anyone help me how to get these? I don’t see any relevant Properties or methods in the API.
You can get the next activity by loading the current process definition, determining the position of the current activity, and figuring out what's next.
This is more or less shown in this post by Mihai Cadariu.
EDIT - Removed silly comment about this not being supported. Since you're in an event system, that code will work. If you want to use it in a Workflow automatic activity then you would have to use the CoreService.
You have next assignee on FinishActivityEventArgs.ActivityFinish.NextAssignee. As for next activity - there's no way to know it for the moment. Consider subscribing to activity instance save event args. This way you will catch what activity was created and who is the assignee.

Resources