Showing posts with label TBUI. Show all posts
Showing posts with label TBUI. Show all posts

Friday, June 17

Getting Task status using scripting

Requirement: Retrieving Task running status using BUSCOMP script

There are requirements where it is required to check in BusComp script if the Task is in running status and put the logic depending on the task running status

Solution:

Write a function on the BC as follows which will return a value to indicate if the task is running:

function GetTaskUIStatus()
{
    try
    {
        var bsTaskUI:Service= TheApplication().GetService("Task UI Service (SWE)");
        var psInput:PropertySet     = TheApplication().NewPropertySet();
        var psOutput:PropertySet = TheApplication().NewPropertySet();   
        var iReturlValue:float = 1;

        bsTaskUI.InvokeMethod("IsNotInTask", psInput, psOutput);   
        iReturlValue =  ToInteger(psOutput.GetProperty("IsNotInTask"));
    }
    catch (e)
    {
    //error handling logic
    }
    finally
    {
    // Destroy variables
    }
    return iReturlValue;   
}

Call this function where ever you want to check if Task is running as given in example below:



function BusComp_PreWriteRecord ()
{
    try   
    {
        if (GetTaskUIStatus() != 0 )
        {
        //Specific actions to be performed if Task UI is not running
        }
    }
    catch(e)
    {
    //error handling block
      }
      finally
      {
    //destroy variables
      }
     return ContinueOperation;
}
If the Task is running value returned is 0 and otherwise it is 1.

Invoking Task from button when no records in the applet

We may get a requirement to invoke TBUI from button click. However, if there are no records on the applet and you click button, error message is shown as below

“An error has occurred while initializing task '<Task Name>'.(SBL-BPR-00535)
A context business component record is required for task 'SWC Create Customer Account'(SBL-BPR-00542)”


there is a SR in metalink but its clueless to resolve this error

You can do following to get this working.

1.    Create one dummy record and store it’s row Id at Application Level.
       E.g. in System Preference or LOV.
       This will have to be done and deployed on all environments as part of migration activities.

2.    Invoke custom method on button click
3.    In that method, Retrieve record using the row id stored in system preference or LOV.
4.    Invoke Task using method LaunchTaskFromScript of the business service Task UI Service (SWE)

Hope this helps :)

Tuesday, May 17

Invoking Task from Applet Button

Hi Readers,

There are requirements where you need to call the task from a button other than the regular method of invoking task from task pane.I have invoked using New button of an applet and thought of sharing this.

Go to applet >> Controls >> NewRecord control and select the HTML Type to 'MiniButton' and change the 'MethodInvoked' property to 'LaunchTask'.
 
Now go to Control user property for this button and create new record as follows

Name: Task Name
Value: Address Creation Task (Give the task name which you want to call from the button)

compile the changes and you are done :)

Why Applet fields Read Only in the TBUI

I was searching alot on the web to find "why all task applet fields are read only,even though applet is in edit mode and No Insert and read only properties are set to false",But unable to find some post that can resolve the issue.So I am posting this as this could help some one facing similar issue.

ISSUE: Applet fields Read Only in the TBUI

I was developing a Task which will insert an address record into S_ADDR_PER with the details provided by the user in task applets.these task applets are based on TBC.If you are not aware of TBC read the below definition.


A transient business component (TBC) is a type of business component whose records exist only during the lifetime of a task instance,Records are cleared when the task UI finishes or is canceled. If the task is paused, then the records remain in temporary storage.

There are four views in my task following by siebel operation step with 'Insert' method,so when user clicks the finish button on the final applet with summary of data, an address record will be created in S_ADDR_PER table.

This is all about what I have to do...I have created Task,Task Apples,Task Views,Task Group and TBC and everything looks fine...Also published and activated the task and added the task to my responsibility.


But I am not able to enter any data in the applet fields as all the fields are READ ONLY...There is no problem with applet template modes and read only properties.

After some research I found that the TBC I have created  as multi record TBC and the class mapped to this TBC is CSSBCTaskTransientBase.This is the problem all my applet fields are read only as the base class can not provide functionality to edit fields in tasks.

The TBC should be mapped to CSSBCTaskTransient only,I have changed the class now and my issue is solved :)


 Hope this helps :)
Blogger Widgets