on 2008 Mar 13 8:34 AM
Hi guys, I have a seriously irritating issue concerning the linking of an activity to service call.
As of Service Pack 01, Patch 36 (at least as far as I know) I get the following error when attempting to create and link an activity to a service call:
Error Code: -5002
Error Description: A service call activity does not exist
I use the folliwing code;
If oServ.GetByKey(MRI) Then
If DocType = "QT" Then
oAct = oComp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oContacts)
oAct.Activity = SAPbobsCOM.BoActivities.cn_Task
oAct.CardCode = oServ.CustomerCode
oAct.DocEntry = DocID
oAct.DocType = 23
oDoc = oComp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oQuotations)
If oDoc.GetByKey(DocID) Then
oAct.Notes = "Sales Quote: " & oDoc.Comments
End If
oAct.Details = "Sales Quote " & DocID & " auto created by MRI " & MRI & ""
If oAct.Add <> 0 Then
oApp.SetStatusBarMessage("Error adding Linked Document Activity for Sales Quote " & DocID & " : " & oComp.GetLastErrorDescription)
oLog.WriteLog("Error adding Linked Document Activity for Sales Quote " & DocID & " : " & oComp.GetLastErrorCode & oComp.GetLastErrorDescription, EventLogEntryType.Error)
Else
oServ.Activities.Add()
oServ.Activities.ActivityCode = oComp.GetNewObjectKey
oServ.Activities.SetCurrentLine(oServ.Activities.Count() - 1)
End If
If oServ.Update <> 0 Then
oApp.SetStatusBarMessage("Error linking Expense Document " & DocID & ":" & oComp.GetLastErrorDescription)
oLog.WriteLog("Error linking Expense Document " & DocID & ":" & oComp.GetLastErrorCode & "-" & oComp.GetLastErrorDescription, EventLogEntryType.Error)
End If
the Activity is added without any problem, but the error comes when linking it to the Service Call (oServ.Update)
Can you please help, I'm going insane with this problem.
How did you solve the issue of the count returning 1 for (0 and 1) linked activities?
Thanks Matt.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is how i got it to work:
ServiceCalls sc = null;
sc = (ServiceCalls)company.GetBusinessObject(BoObjectTypes.oServiceCalls);
if (!sc.GetByKey(callId))
throw new Exception("Failed to add service call activity! Service call does not exist!");
if (sc.Activities.Count == 1)
{
sc.Activities.SetCurrentLine(sc.Activities.Count - 1);
string temp = sc.Activities.ActivityCode.ToString();
if (!string.IsNullOrEmpty(temp) && !temp.Equals("0"))
sc.Activities.Add();
}
else
sc.Activities.Add();
sc.Activities.SetCurrentLine(sc.Activities.Count - 1);
sc.Activities.ActivityCode = int.Parse(lastAcctivity);
if (sc.Update() != 0)
{
company.GetLastError(out errorCode, out errorMsg);
if (null != sc)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(sc);
sc = null;
}
throw new Exception(errorCode + " -> " + errorMsg);
}
You could either use that piece of code or make an insert in SCL5.
Hi,
maybe it has something to do that you have not set the
ParentobjectId
Description:
Returns the source object ID of the activity:
-For Service Call object type: ServiceCallID.
-For Sales Opportunity object type: SequentialNo.
iam not sure if it will help you, but have a look at it
regards
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have found the source of the problem. It seems that as of SP01 PL36 (+-) SBO does not require you to create a new activity line for the Service Call if it's the first activity to be linked. In other words, for the first activity to be linked you should not add oServiceCall.Activities.Add. However, this line of code is required for any additional activities to be added.
I do not agree with this methodology seeing as it only makes sence if you are linking a batch of Activities through a loop. The problem is that usually you will only want to link a single Activity at a time after a specific action was taken.
Also, the oServiceCall.Activities.count returns 1 if there is 1 OR zero activities linked to the service call.
Anyway, I hope this helps anyone struggling with this issue.
User | Count |
---|---|
100 | |
9 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.