on 09-22-2014 1:08 PM
Hi Experts,
Scenario: I want to create the data from ABSL code with root as well as node level data.
I have created the Custom BO with the below elements:
businessobject CustomAllActivity {
[Label("ID")] [AlternativeKey] element ID : ID;
[Label("Description")] [AlternativeKey] element Desc : LANGUAGEINDEPENDENT_Text;
[Label("Start Date")] element StartDate : Date;
[Label("End Date")] element EndDate : Date;
Node allActivity [0,n] {
element ActivityID : BusinessTransactionDocumentID; // Activity ID from Standard BO
element ActivityName : EXTENDED_Name; // Activity Name / Desccription from Standard BO
element ActivityType : LANGUAGEINDEPENDENT_Text; // Activity Type(PhoneCall, Task, Email etc...) from Standard BO
[DependentObject(TextCollection)] [MultipleTexts] node MyNote; // Activity Notes from Standard BO
}
}
I want to get all the Activity ( Phone Call , Task , Appointment , Email ) and Store into the Custom BO node entry based on the Date..
I have created the Object-based screen for this business object.
I want when user click on New from OWL under the QA screen user can able to enter the "Description , StartData and EndDate" and save the entry based on start date and end date i need to fire a query on date of creation in activity and based on that store data under the custom entry in node allActivity
Please refer the above screen for more details.
at last i want the code to save the root level as well as node level data in same time on custom action or standard event(AfterModify , OnSave etc....)
Kindly help me to solve this issue.
Many Thanks,
Mithun
Hello Mithun,
If you create / modify any node (Root or any subnode) it will be persisted on Save.
So I do not get your issue.
Do you ask how to make the AllActivity node optional?
Bye,
Horst
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Horst,
I want to create entry on node level when user click on Update Data button as mentioned above screen.
so in my custom bo the root level data created but i want to create / modify the entry on node level.
so in the above screen my root level data i can able to save without node level data. also i can enter the test data in node level.
But i want to store data from Standard BO All Activity ( Email , Task , Appointment , PhoneCall ) and store the ID , Name / Description , Notes and ActivityType using ABSL code.
So in the above screen i have made 1 button called "Update Data" and also create action on node level i have add "action updateAll;" in business object as shown below.
Node allActivity [0,n] {
element ActivityID : BusinessTransactionDocumentID; // Activity ID from Standard BO
element ActivityName : EXTENDED_Name; // Activity Name / Desccription from Standard BO
element ActivityType : LANGUAGEINDEPENDENT_Text; // Activity Type(PhoneCall, Task, Email etc...) from Standard BO
[DependentObject(TextCollection)] [MultipleTexts] node MyNote; // Activity Notes from Standard BO
action UpdateAll;
}
So in short i want to update / modify / create data under the node level using anyway.
But where i can do the coding and what coding require to create entry in node level
1)Custom Action button
or
2) Standard Event Handler at Root level (Root: AfterModify , Root:BeforeSave, Root: OnSave and Root :etcc......)
or
2) Standard Event Handler node level (node: AfterModify , node:BeforeSave, node: OnSave and Root :etcc......)
kindly guide me what i can do to achieve this requirement.
Many Thanks,
Mithun
Hi Mithun,
As per what i understand is you want to create Node data but without root? Thats not possible.
Atleast instance of Root has to be there secondly.
You can create Data of Node by code :
HeaderOpputInst = this.<<NodeName>>.Create(); ( Here this has an instance of Root).
you can create action for Root or in my scenario i have done this codding in Root's Event After Modify.
secondly :
What i understand is ypu will store data of activities in your BO? if yes then you can directlyuse the association.
node PhoneActivities [0,n]{
element BusinessTransactionDocumentReference : BusinessTransactionDocumentReference;
element BusinessTransactionDocumentRelationshipRoleCode : BusinessTransactionDocumentRelationshipRoleCode;
element OpportunityUUID : UUID;
element Opportunityname : LANGUAGEINDEPENDENT_LONG_Name;
association PhoneActivity[0,1] to Activity;
}
then you dont have to worry about data getting saved in activity bo.
I hope i have understood your requirment clearly.
Regards,
Dhruvin
Hi Dhruvin,
Case 1 : If in my bo the root level data or header data saved and i want to update/create the node level data than what is the code and in which event i need to modify for coding to update / create node level data on existing instance.
I am using the below code to get the phone call activity using query and store into the variables as shown below.
import AP.FO.Activity.Global;
var queryphonecall;
var phoneres;
var phoneparam;
var actid;
var actname;
var acttype;
var actnotes;
var Child_elements:elementsof Custom_Activity_BO.ActivityList; // Child BO
var Child_node;
// Write the code to get data fromQueryByElements;
queryphonecall = PhoneCallActivity.QueryByElements;
// Execute the Query
phoneres = queryphonecall.Execute();
// Set the Selection parameters for query
phoneparam = queryphonecall.CreateSelectionParams();
// Pass the value in selection parameters
phoneparam.Add(phonecall.ID.content, "I", "EQ", "2901");
// Execute the query with selection parameters
phoneres = queryphonecall.Execute(phoneparam);
// Fill all the data require in the variables
actid = phoneres.GetFirst().ID;
actname = phoneres.GetFirst().Name.content;
acttype = phoneres.GetFirst().TypeCode.GetDescription();
actnotes = phoneres.GetFirst().TextCollection.Text.GetFirst().TextContent.Text.content;
// Store the value in chide level (node level elements from variables
Child_elements.ActivityID = actid;
Child_elements.ActivityName.content = actname;
now i dont know where i can write this code and after the above code what is the syntax to create/update the data on existing instance.
On which event i put this code and update node level items.
So in my scenario the test case like that.
Step 1. Click on New button from OWL to create entry.
Step 2. Enter the Root level ( Header level ) data and save the content(Only Root level).
Step 3. User click on "Update All" button and get the all the activity ( ID , Name , Type , Notes ) and store into the node level as shown below and save it.
How to achieve the above requirement using ABSL code and where to write down the code to update the node level ( child level ) data using specific action or event.
Many Thanks,
Mithun
Hello Horst,
Can you please suggest me where i need to put this code or in which action or event i need to put this code because i have already root level data exist and i want to update/create the node level data on existing root level data that i have mentioned in the above steps with screen..
Kindly help me to solve this issue.
Many Thanks,
Mithun
Hi Mithun,
Create an Action to the custom BO and write your code there. Create an event handler that calls BOAction, bind your action and assign this event to OnClick property. You will find this property in Property explorer when you select Update Data button. Hope this clarifies.
Regards
Jagathshree.
Thanks Experts,
I can able to add the data under the node level using the sample code;
var rootref : elementsof Root_Node;
var noderef : elementsof Root_Node.Node;
var rootcrt;
var nodecrt;
if(this.IsSet())
{
if (this.Root1.IsInitial() && this.Root2.IsInitial())
{
// Prepare Node Data
noderef.node1 = "Node1";
noderef.node2 = "Node2";
// Create Node Data on
nodecrt = this.Node.Create(noderef);
// Clear Node Ref
noderef.Clear();
// Prepare Node Data Again
noderef.node1 = "Node1";
noderef.node2 = "Node2";
// Create Node data on Root level
nodecrt = this.Node.Create(noderef);
}
Thanks a lot for you valuable inputs and comments.
many thanks,
Mithun
Hi,
In my create node level data i can able to create 1 or 2 record using above code but when i fire a query and create the node level item using foreach loop i am getting the error or dump.
i am using the below code to create node level data from phonecall activity using FromDate to ToDate. selection parameters.
import ABSL;
import A1S.Global;
import AP.CRM.Global;
import AP.Common.GDT;
import AP.FO.Activity.Global;
import AP.PC.ActivityManagement.Global;
// Root and Node Level Variables
var rootref : elementsof BOCustomActivity;
var noderef : elementsof BOCustomActivity.Cust_Act_send;
var nodetxtref : elementsof BOCustomActivity.Cust_Act_send.myNode.Text.TextContent;
var rootins;
var nodeins;
var nodetxtins;
// PhoneCall Activity Query Related Variables
var query;
var result;
var selection;
// Variable For Global Date Time
var GDate1 : PhoneCallActivity.ReportedDateTime;
var GDate2 : PhoneCallActivity.ReportedDateTime;
var Date1 : DataType::Date;
var Date2 : DataType::Date;
// Code Start
if (this.IsSet())
{
// Check the From Date and To Date must be filled or not initial
if(!this.StartDate.IsInitial() && !this.EndDate.IsInitial())
{
// Check the Start Date not less than End Date
if(this.StartDate.LessThan(this.EndDate))
{
//*****************************************************
// Phone Call Activity Query
//*****************************************************
Date1 = this.StartDate;
Date2 = this.EndDate;
GDate1 = Date1.ConvertToGlobalDateTime();
GDate2 = Date2.ConvertToGlobalDateTime();
query = PhoneCallActivity.QueryByElements;
result = query.Execute();
selection = query.CreateSelectionParams();
selection.Add(query.ReportedDateTime, "I", "BT" , GDate1, GDate2);
result = query.Execute(selection);
if(result.Count()>0)
{
foreach (var Phactivity in result)
{
noderef.ActID = Phactivity.ID;
noderef.ActName.content = Phactivity.Name.content;
noderef.ActType = Phactivity.TypeCode.GetDescription();
noderef.ActAcc = Phactivity.ActivityParty.GetFirst().PartyKey.PartyID;
noderef.ActOwn = Phactivity.EmployeeResponsibleParty.PartyKey.PartyID;
noderef.ActDtime = Phactivity.ReportedDateTime;
// Create Node Instance with data
nodeins = this.Cust_Act_send.Create(noderef);
noderef.Clear();
}
}
//*****************************************************
// End of Phone Call Activity Update
//*****************************************************
}
else
{
raise DateMessage.Create("E",this.StartDate,this.EndDate);
}
}
else
{
raise NotInitial.Create("E");
}
}
Query 1
What is the wrong in the above code?
when i debug i am getting the records in query result more than 1 record when i go to foreach loop upto the Create node method the cursor go without error but after next record the system running and gives the exception or dump in front end.
Query 2.
i am also use the TextCollection on node level using [DependentObject(TextCollection)] node myNode i want to also
update the record from PhoneCallActivity notes.
how i can update the same using the above code?
Please help me to resolve this issue.
I have attach the code file.
Many Thanks,
Mithun
Sorry Sir,
I do not aware about this tools. can you please suggest me where i can get this tools?
In the above code is there any correction required or any wrong statement?
because when i update only 1 record or 2 record using sample code i have post previous in this post then i can able to get the data.
Many Thanks,
Mithun
Hello Sir,
i have run today and check the eDump Analysis tool i am getting the error as below.
6:02:37 PM | MARRY.COM | No access possible via a 'NULL' data reference. | YST9YOLXY_ | /YST9YOLXY_MAIN/SRC/BOCustomActivity-Root-Action-UpdateData.absl | 77 | 5 |
can you tell me what is the error above and how to solve this ?
I have check using debug and the above 2 value coming blank and i am getting dump because of the 2 value Account and Owner from the Phone Call Activity.
Full scenario :
1) From the Phone call activity i get the data between Start Date and End Date on query and fire query.
2) I can able to retrieve 4 records data as shown below screen
3) make foreach loop to get 1 by 1 data and assign to my node level elements and create record.
4) Clear the node level reference.
now under the screen of standard phone call activity i have records with no account and owner so the error i am getting because of that.
I have try using the below code but same issue.
foreach (var Phactivity in result)
{
noderef.ActID = Phactivity.ID;
noderef.ActName.content = Phactivity.Name.content;
noderef.ActType = Phactivity.TypeCode.GetDescription();
if (!Phactivity.ActivityParty.GetFirst().PartyKey.PartyID.content.IsInitial())
{
noderef.ActAcc.content = Phactivity.ActivityParty.GetFirst().PartyKey.PartyID.content;
}
if (!Phactivity.EmployeeResponsibleParty.PartyKey.PartyID.content.IsInitial())
{
noderef.ActOwn.content = Phactivity.EmployeeResponsibleParty.PartyKey.PartyID.content;
}
noderef.ActDtime = Phactivity.ReportedDateTime;
nodeins = this.Cust_Act_send.Create(noderef);
noderef.Clear();
}
i have check the not initial content from the results but getting error.
but when i comment the on noderef.ActAcc.content and noderef.ActOwn.content i can able to save the record on the node level data as shown below.
can you please what is wrong in the above code and what is the solution for that?
Many Thanks
Mithun
.
Hello Sir,
In my case i am using the TextCollection under the node level data like this.
node Cust_Act_send [0,n] { |
[Label("Activity ID")] element ActID : BusinessTransactionDocumentID; | |||
[Label("Activity Subject")] element ActName : EXTENDED_Name; | |||
[Label("Activity Type")] element ActType : LANGUAGEINDEPENDENT_MEDIUM_Text; | |||
[Label("Account")] element ActAcc : PartyID; | |||
[Label("Owner")] element ActOwn : PartyID; | |||
[DependentObject(TextCollection)] node myNode; | |||
} |
how to assign the Text from activity notes to this custom node level text?
foreach (var Phactivity in result)
{
noderef.ActID = Phactivity.ID;
noderef.ActName.content = Phactivity.Name.content;
noderef.ActType = Phactivity.TypeCode.GetDescription();
if (Phactivity.ActivityParty.Count()>0) {
if (!Phactivity.ActivityParty.GetFirst().PartyKey.PartyID.content.IsInitial()) {
noderef.ActAcc.content = Phactivity.ActivityParty.GetFirst().PartyKey.PartyID.content; } }
if (!Phactivity.EmployeeResponsibleParty.PartyKey.PartyID.content.IsInitial()) {
noderef.ActOwn.content = Phactivity.EmployeeResponsibleParty.PartyKey.PartyID.content; }
noderef.ActDtime = Phactivity.ReportedDateTime;
noderef.myNode = Phactivity.TextCollection.Text.GetFirst().TextContent.Text.content
nodeins = this.Cust_Act_send.Create(noderef)
the above code i want to add notes from activity and assign to myNode at node level and after that Text content display under the table.
When i check under "noderef.myNode = Phactivity.TextCollection.Text.GetFirst().TextContent.Text.content"
As you can see that i can update node level data but i want also to get Notes from activity and update at node level.
Here the below screen is fro standard phone call activity that i have updated in my custom table as shown above but in the below screen the Notes field i want to get and update on my node level data.
Can you please help me how to update the Notes under the node level?
Many Thanks,
Mithun
Hello sir,
below is my BO definition
import AP.Common.GDT as apCommonGDT;
import AP.FO.Activity.Global;
import AP.PC.ActivityManagement.Global;
import AP.CRM.Global;
businessobject BOCustomActivity raises DateMessage,NotInitial,updatesuccess{
message DateMessage text "From-Date &1 is grater than To-date &1." : Date, Date;
message NotInitial text "From-Date and To-date should be not inistal.";
message updatesuccess text "Node Level Data Successfully Updated.";
[Label("Description")] element Descr : LANGUAGEINDEPENDENT_LONG_Text;
[Label("Start Date")] element StartDate : Date;
[Label("End Date")] element EndDate : Date;
[Label("Update Node")] element Nodepd : Indicator;
[Label("Generate PDF")] element Nodepdf : Indicator;
[Label("Send EMail")] element Nodesend : Indicator;
node Cust_Act_send [0,n] {
[Label("Activity ID")] element ActID : BusinessTransactionDocumentID;
[Label("Activity Subject")] element ActName : EXTENDED_Name;
[Label("Activity Type")] element ActType : LANGUAGEINDEPENDENT_MEDIUM_Text;
[Label("Account")] element ActAcc : PartyID;
[Label("Owner")] element ActOwn : PartyID;
[Label("DateTime")] element ActDtime : GLOBAL_DateTime;
[DependentObject(TextCollection)] node myNode;
}
[DependentObject(AttachmentFolder)] node Attachment;
action GeneratPDF;
action SendEmail;
action UpdateData;
}
Hello MIthun,
You can not simply assign the content of an element of a node to a reference of the Dependent Object TextCollection (or any other reference).
See the answer in this discussion.
HTH,
Horst
I am using the code as below to copy TextCollection from Standard Activity Notes.
nodeins = this.Cust_Act_send.Create(noderef);
if (!nodeins.myNode.IsSet())
{
nodeins.myNode.Create();
}
// Clear Data
foreach(var remove in nodeins.myNode.Text)
{
remove.Delete();
}
foreach(var originaltext in Phactivity.TextCollection.Text)
{
var newtext = nodeins.myNode.Text.Create();
newtext.TypeCode.content = originaltext.TypeCode.content;
newtext.LanguageCode = originaltext.LanguageCode;
if (originaltext.TextContent.IsSet())
{
if (newtext.TextContent.IsSet())
{
newtext.TextContent.Create();
}
newtext.TextContent.Text.content = originaltext.TextContent.Text.content;
}
}
please suggest me if i am using the wrong code ?
Many Thanks,
Mithun
Hello Mithun,
Your code may look like this
// create the node instance for activities with data
var nodeIns = this.Cust_Act_send.Create(noderef);
// TextCollection myNode is empty as this is newly created
// copy from PhoneActivity
foreach( var originalText in Phactivity.TextCollection) {
// new TextCollection, link to BOCustomActivity is set via path "this...."
var newText = this.Cust_Act_send.myNode.Create();
// copy values
newText.TypeCode.content = originalText.TypeCode.content;
newText.LanguageCode = originalText.LanguageCode;
// do not copy empty text
if (originalText.TextContent.IsSet()) {
newText.TextContent.Create();
newText.TextContent.Text.content = originalText.TextContent.Text.content;
}
}
Maybe the biggest difficulty is that a Dependent Object "knows" from the creation path to which instance of which BO it belongs to.
Therefore there is not direct assignment to the "myNode" .
HTH,
Horst
Hello Sir,
I have make change the code as below for simplicity,
import ABSL;
import A1S.Global;
import AP.CRM.Global;
import AP.Common.GDT;
import AP.FO.Activity.Global;
import AP.PC.ActivityManagement.Global;
var noderef : elementsof BOCustomActivity.Cust_Act_send;
var nodetxt : elementsof BOCustomActivity.Cust_Act_send.myNode;
var nodeins;
var query = PhoneCallActivity.QueryByElements;
var resultData = query.Execute();
//2. Selection
var selectionParams = query.CreateSelectionParams();
selectionParams.Add(query.ID.content, "I", "BT", "2551", "2555");
//Result
resultData = query.Execute(selectionParams);
foreach ( var record in resultData)
{
noderef.ActID = record.ID;
noderef.ActName.content = record.Name.content;
noderef.ActType = record.TypeCode.GetDescription();
nodeins = this.Cust_Act_send.Create(noderef);
if (record.TextCollection.IsSet() && record.TextCollection.Text.Count() > 0) {
foreach (var txtCnt in record.TextCollection.Text)
{
if(txtCnt.IsSet())
{
if (txtCnt.TextContent.IsSet()) //if (txtCnt.TextContent.IsSet())
{
var text = nodeins.myNode.Text.Create();
var txtcontent = text.TextContent.Create();
txtcontent.Text = txtCnt.TextContent.Text;
}
}
}
}
}
When i execute and debug i am getting error / dump the statement highlighted in yellow color.
Error Details :
4:33:21 PM | MARRY.COM | No access possible via a 'NULL' data reference. | YST9YOLXY_ | /YST9YOLXY_MAIN/SRC/BOCustomActivity-Root-Action-UpdateData.absl | n/a | n/a |
Please let me know where i am wrong.
Many Thanks,
Mithun
Hello Mithun,
With this code
nodeins = this.Cust_Act_send.Create(noderef);
you created an instance of node "Cust_Act_send"
You do not have created an instance of node "Cust_Act_send.TextCollection"
But with this code
var text = nodeins.myNode.Text.Create();
You try to access via "myNode" this TextCollection.
Therefore this error.
My example reads
var newText = this.Cust_Act_send.myNode.Create();
Here you create the TextCollection
HTH,
Horst
PS: Naming of the nodes and their elements according their types helps
Hi Mithun Suthar,
I also added the data at root level in AfterModify script file. but in the UI i could able to see those records. How do i refresh the List to see the data ?
Thanks,
Naga
Hi Mithun Suthar,
Let me explain you in-detail.
1. I have a ListPane and 4 fields. 1 filed is having F4 Help.
2. Based on the selected value of 1 field's F4 Help, i need to fill the other fields in same row and i also need to append some extra records in the DataListPane.
What i did till now.
1. I implemented AfterModify script , so that i will get the 1 field value in the script.
2. i filled the other fields in the same row.
3. i used the below code to create the 2 records.
var noderef = TestBo.Create(struct);
collection.Add(noderef);
After completion of the script execution, i should see the 2 newly added records in the DataListPane
This is not happenning. This is the issue ?
Hope you got what i meant.
Thanks,
Naga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.