on 10-03-2014 10:01 AM
Hi Experts,
Scenario : I have requirement to copy some fields ( Activity ID , Subject , Notes etc) from standard activity ( Phone Call , Appointment , Task etc) into my custom business object node level data .
Issue : How to Copy Notes field from standard activity into my custom activity Notes fields my custom business object sample definition
businessobject BOCustomActivity {
[Label("Description")] element Descr : LANGUAGEINDEPENDENT_LONG_Text;
[Label("Start Date")] element StartDate : Date;
[Label("End Date")] element EndDate : Date;
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;
[DependentObject(TextCollection)] node myNode;
}
action UpdateData;
}
In the above business object under the node level i can assign the Activity ID, Activity Subject , Activity Type from standard activity using Query and update the node level records,
But I want to assign Notes ( TextCollection Text ) from standard activity notes fields.
In the below screen we have 2 records from standard phone call activity.
I am using the below code to get the record from standard phone call activity.
import ABSL;
import AP.FO.Activity.Global;
var noderef : elementsof BOCustomActivity.Cust_Act_send;
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();
(?) = record.TextCollection.Text.TextContent.GetFirst().Text.content
nodeins = this.Attachment.Create(noderef);
}
in the above code the Activity ID , Activity Name , Activity Type but how to copy the Notes ( TextCollection Text ) into the node element myNode (TextCollection) and assign and update on node level element .
But did not solve the issue.
Please anyone have idea about the above requirement.
IF anyone want more explanation kindly let me know.
Many Thanks,
Mithun
Hello
try this (I didn't try in my system maybe some adjustements are needed)
if (record.TextCollectiont.IsSet() && record.TextCollection.Text.Count() > 0){
foreach (var txtCnt in record.TextCollection.Text){
if (txtCnt.Text.isSet()){
if (!noderef.TextCollection.IsSet()){
noderef.TextCollection.Create();
}
var text = noderef.TextCollection.Text.Create();
var textContent = text.TextContent.Create();
textContent.Text = txtCnt.Text.TextContent.Text;
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sir,
In my BO structure
businessobject BOCustomActivity {
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;
[DependentObject(TextCollection)] node myNode;
}
action UpdateData;
}
and in ABSL code :
var noderef : elementsof BOCustomActivity.Cust_Act_send;
Here the noderef is the reference of the only node Cust_Act_send.
When i type
noderef.mynode is not possible
or
nodefer.TextCollection.Create(); is also not possible in my case.
Do you have another ways similar with my businessobject ?
Also where i can put the your code before node create or after node create?
Before this Code
nodeins = this.Cust_Act_send.Create(noderef);
or
After this code
nodeins = this.Cust_Act_send.Create(noderef);
Many Thanks,
Mithun
Hello,
yes sorry, I didn't notice.
In this case you have to put my code after the node creation, so after the line
nodeins = this.Cust_Act_send.Create(noderef);
then:
Sorry Sir,
But i tried the above code getting below error.
because nodeins is simple variable
var nodeins;
and i am using nodeins at
nodeins = this.Cust_Act_send.Create(noderef);
and this statement create the node entry but not update myNode because this is DependentTextCollection [DependentObject(TextCollection)] node myNode;
Can you please suggest me how to create or assign value to myNode text context?
Many Thanks,
Mithun
Hello sir,
I am getting exception or dump in the below code...
if (record.TextCollection.IsSet() && record.TextCollection.Text.Count() > 0) {
foreach (var txtCnt in record.TextCollection.Text)
{
if (txtCnt.TextContent.IsSet()) // Error in this line
{
var text = nodeins.myNode.Text.Create();
var txtcontent = text.TextContent.Create();
txtcontent.Text = txtCnt.TextContent.Text;
}
}
}
Error Details : No access possible via a 'NULL' data reference.
Please suggest me whats wrong in the above code?
Many Thanks,
Mithun
So you are getting an error on txtCnt instance, and this error is saying that the instance is null.
This is not possible because of the if condition that you put before (if(txtCnt.IsSet()){...})
Please try to reactivate the method and refresh the UI, if the problem persists I am really confused. Maybe you should raise an incident.
Anyway please note also that the PhoneCallActivity BO is deprecated and should not be used. You should use Activity BO instead.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.