Tuesday, April 28, 2009

FirstRecord() in PreCanInvoke Event : Refresh Issue

Today I am going to tell you about an interesting issue that we faced in our Production Env and really worked hard to figure it out the root cause for it.


The issue was :

On Activity Form applet, we have "Comments" field, which is 2000 characters long and user to write a detail description in this field related to that activity record. Now few of the users faced the issue that "while typing some text in Comments field, suddenly the whole text written get deleted and Comments field become blank". User get frustrated as he need to type in the whole text again and also the next time not sure whether he will able to complete putting text in Comments field or not. For a temporary workaround they used to first type in all the text in a NotePad file and then copy paste the complete text at once in Comments field and save the record.

What we tried :

When we tried replicating this issue in our dedicated env, we were unable to replicate it. After lot much of effort our QA Team was able to replicate it sometimes on our thin client. But the problem was this is not always happening with them as well. On some of the machines we were not able to replicate it at all. Totally a random behaviour.

Now the problem was to find out the steps so that we can replicate it. We have one option to try i.e. by disabling all the Server Script and check if we can replicate the issue in thin client (since in dedicated client everything was working fine).

We changed the "EnableScripting" = False and restart the Siebel server, and found that the issue is not coming anymore. So we narrowed down for the root cause of the problem to Scripting.


And, here is what we finally found :

On PreCanInvoke method of the applet we had a script written, something like :


if (MethodName == "Test")
{
if(this.BusComp().FirstRecord())
CanInvoke = "True";
return (CancelOperation);
}


So, what was happening when user was typing some text in Comments field, it seems like IE web page get refreshed and due to this the code written on "PreCanInvoke" method was getting invoked and due to the "FirstRecord()" method used inside the code, the current record get refreshed and resulting in no text in Comments field.

Finally, we were able to find the root cause of the problem, now its the time to look for some workaround. So we decided not to enable/disable button using PreCavInvoke script, rather put a check message in PreInvoke method when there is no record displayed. So here below is final version of script we used :

PreCanInvoke Method

if (MethodName == "Test")
{

CanInvoke = "True";
return (CancelOperation);

}


PreInvoke Method :

if(MethodName == "Test")
{
if(this.BusComp().FirstRecord())
{
TheApplication().RaiseErrorText("This operation is not valid, when record is not displayed");

}
return (CancelOperation);
}


Recommendation:
Avoid writing scripting on PreCanInvoke Method of Applet, as this is the event which fires on each and every action we do on the applet + at the time of automatic refresh of web page.

Sunday, April 26, 2009

Scheduling Automatic Export in Siebel

List applets provide the OOB export functionality which is very useful sometimes when Managers want to do some analysis depending on various combinations and permutations on the live data very quickly. But if you need to do the same task on the daily basis, you will think, can't I get the export automatically from Siebel via email instead of I go to the list applet and take the export. The same happened with my client too. He want to automate this export process that he generally does on the daily basis from All Service Requests List Applet.

Lets see how this is achievable :

On the very high level, the solution is to :
  1. Create a Workflow which can take the Export and send it in an email to the user.
  2. Create a RCR (Repeating Component Request) which will get executed on the daily basis and run a workflow.

Workflow Creation:


Here below are major steps that used in Workflow to acheive the solution.

  • Query Service Request
    Business Service Name = Import/Export
    Business Service Method = Export
    Input arguments for this step are as follows :

    ==> FileName : "<_filename.xls>" (for eg: /temp/export.xls). Please make sure you should provide the extension as .xls

    ==> FileType: XML

    ==> IntObjectName : Service Request (this is the IO that I have created which has only one Integration Component i.e. Service Request). You can also use the OOB available IO for this purpose, if fits into the requirement.


  • Send Email
    Business Service Name : Outbound Communications Manager
    Business Service Method Name : SendMessage
    Input arguments for this step are as follows :

    ==> MsgToList : "<_youremailaddress>"

    ==> CommProfile : "<_communicationprofilename>". if you want to know, how to setup a Communication Profile, please refer to :
    http://siebelmantra.blogspot.com/2009/04/how-to-setup-communication-profile-for.html

    ==> MsgSubject : Export from Siebel

    ==> MsgBody : This is the test export from Siebel

    ==> AttachFileList : <_filename.xls>. (for eg: /temp/export.xls).

Workflow is ready, Publish and Activate it and simulate it on the Server to check if running fine.

RCR (Repeating Component Request) Creation :

Here below are the steps for creating the RCR job and let the Workflow run on the daily basis.

  • Navigate to "Administration-Management -> Jobs" view.
  • Click on "New" and select "Component/Job" = "Workflow Process Manager".
  • Under Repeating Info section, select the following :
  • Under Job Parameters applet, create a new select with the following info :
    Workflow Process Name : <_name>
  • Click on "Submit Job"

And you are done with the complete process. Siebel will automatically take the export and send you the file on the daily basis.

Enjoy !!!!


Friday, April 24, 2009

How to setup a Communication Profile for sending email from Siebel ?

I was working on our Sandbox Env, that we have newly setup for some R&D purpose, and got the requirement to send an email from Siebel via F9 functionality. Since it is a new env, nothing has been setup on that from administration standpoint, so I need to start from the scratch to setup a communication profile. So let me tell you today what all you to do for this :

  1. Navigate to "Administration - Communications -> Communication Profiles & Drivers" view.
  2. Query for "Internet SMTP/POP3 Server" under Communications Drivers applet.
  3. Create a new Profile. Lets say "Test Email Profile".
  4. Under Profile Parameter Overrides applet, add the following parameters :
    ==> From Address : Any Email Address (Generally it should be Siebel Email box Id )
    ==> SMTP Server : Name of the SMTP Server which will send the email.
    ==> SMTP Server Port : 25
  5. Click on "Menu" button on "Profiles" applet and click on "Submit Profile Changes".
  6. Uptill this point you are ready to use this communication profile but before this need to check whether Server Component, responsible for executing the email request are running properly or not. So continue with the next step.
  7. Navigate to "Administration-Configuration -> Enterprises -> Component Groups" and query for "Communications Management" under component groups applet and then query for "Communications Outbound Manager" component under "Components" applet. This is the component which is responsible for sending outgoing emails from Siebel.
  8. Check if "Enabled on Server" flag is checked under "Component Group Assignments" applet. If not click on "Enable" button.
  9. Navigate to "Administration-Configuration -> Enterprises -> Component Definitions" and query for "Communications Outbound Manager".
  10. Set the following two parameters to "Test Email Profile" (Communication profile created in Step# 3)
    ==> Comm Profile Override
    ==> Communication Profile
  11. Click on "Synchronize" button.
  12. Now restart the Siebel server.
  13. Navigate to Tools -> User Preferences -> Outbound Communications view and select "Siebel Email Client" in Email Client. Click on Save.


And you are done with the profile creation and hopefully it should work fine. Lets test it out.

Navigate to Service Request Screen -> My Service Requests view, Click F9 and system will give you the Popup form to send an email. Put your email address in "To" section and fill in the subject and body as per your wish and send it.

Check your Inbox, you will see the email in few minutes. Also drilldown on SR# field and navigate to "Activities" view, you will an activity of type "Email - Outbound" and the contents of the email in Comments field. This is Siebel OOB functionality of creating activity under Service Request whenever you send an email from Service Request record.

Troubleshooting :

Let me tell you about the error which is most likely to occur while sending emails from Siebel once you have setup a new Communication Profile. What happens is you followed above steps and still not received any email. Go to "Administration-Management" Drilldown on Component "Communications Oubound Manager" and check the log. You may see the error : "Client does not have permission to submit mail to this server".
This error most likely occur when there exist a firewall between your Siebel server and SMTP server, so what happens is Siebel Server is not able to create any email request on the SMTP server. Just talk to your network administrator and get the name of SMTP server without any firewall. It will work.

Hope this helps !!!!!