Thursday, January 31, 2013

[FieldName.TransCode]

While the whole world running for Open UI but I am still flagging my own old issues.Recently during performance improvement drive from my inner soul,  i read an interesting property while querying on Multilingual fields. If you know about TransCode function this post in not for you.

In Multilingual environment, with loads of records, querying on Multilingual field can be really taxing as these searches require a join to the S_LST_OF_VAL table in the resulting SQL code. To increase the performance one can append "TransCode" function with field name to retrieve the (untranslated) language-independent code (LIC) from a column in the base table, rather than returning the display value.
Syntax:
[Status.TransCode] = 'closed'

This function can be used in
1 - In Calculated Fields.
2 - In script. for ex. in GetFieldValue("Status.TransCode") statement
3 - In Workflows.
4 - In Link/Picklist searchspec.
5 - In DVM validation expression.

I am sure most of guys in siebel development will be aware of this thing but if you are not aware of this Transcode it can be helpful in future implementations.


Happy Crunching!!

Sunday, January 20, 2013

adding voice input in siebel openUI :: Physical Render experiement


Please Note: Here we are using a webkit property. That means this feature will work only in google chrome.
Google chrome supports it's own voice search property. We can add this property to our application by adding "x-webkit-speech" in our input fields. Here we can create a physical render and implement this feature.


<!-------------------CODE Begins----------------------------!>

if( typeof( SiebelAppFacade.GoogleVoicePR ) === "undefined" ){
    SiebelJS.Namespace( "SiebelAppFacade.GoogleVoicePR" );
   
    SiebelApp.S_App.RegisterConstructorAgainstKey( "GoogleVoicePRenderer", "SiebelAppFacade.GoogleVoicePR" );
   
    SiebelAppFacade.GoogleVoicePR = ( function(){
       
       
        function GoogleVoicePR( pm ){
            SiebelAppFacade.GoogleVoicePR.superclass.constructor.call( this, pm );
            var controls = this.GetPM().Get( "GetControls" );
            var cntrl = controls[ "Last Name" ];   
            var lastNameCntrl  = cntrl.GetInputName();
            $('input[name="'+lastNameCntrl+'"]').attr("x-webkit-speech","x-webkit-speech");

        }
       
        SiebelJS.Extend( GoogleVoicePR, SiebelAppFacade.PhysicalRenderer );
       
        return GoogleVoicePR;
    }());
}


<!-------------------Code Ends------------------------------!>

Thursday, January 17, 2013

Mapping & Finishing customization (Part � 4)



This is our final steps in this customization. Here we are going to Map our custom physical render & Physical Model.  We are validating the EmailAddress field in contact form applet.
We are mapping our Key. Hope you remember our key, that we used to register.


So in tools go to contact  form applet.
Expand Applet user property
1.       Create a new user property Name -> Physical_Render and Render Key as its value (Shown in fig)
Another user property Physical_Model and Model key as its  value.
Compile Object.
2.       Now Copy our code (Physical Render & Physical model )to SCRIPTS->Siebel->custom folder
3.       Open OBJECTSFolder. There you can see �manifest_extensions.map�. Open  this in a notepad or wordpad.  Map our Key with applet.

4.       Open �custom_manifest.xml� in the same folder.
Find  <PLATFORM_KEY_SPECIFIC>
                                <PLATFORM Name="Desktop">
Here we map our physical render
Open a new node and write our file name as shown in fig

Find <KEY_COMMON>
Here we map our physical Model
And map our new key as shown in fig.


Now we finished everything. Make sure that you compiled applet. Clear your browser cache.  And launch application and change your email. Hope everything works well.

Mapping & Finishing customization (Part – 4)



This is our final steps in this customization. Here we are going to Map our custom physical render & Physical Model.  We are validating the EmailAddress field in contact form applet.
We are mapping our Key. Hope you remember our key, that we used to register.


So in tools go to contact  form applet.
Expand Applet user property
1.       Create a new user property Name -> Physical_Render and Render Key as its value (Shown in fig)
Another user property Physical_Model and Model key as its  value.
Compile Object.
2.       Now Copy our code (Physical Render & Physical model )to SCRIPTS->Siebel->custom folder
3.       Open OBJECTSFolder. There you can see “manifest_extensions.map”. Open  this in a notepad or wordpad.  Map our Key with applet.

4.       Open “custom_manifest.xml” in the same folder.
Find  <PLATFORM_KEY_SPECIFIC>
                                <PLATFORM Name="Desktop">
Here we map our physical render
Open a new node and write our file name as shown in fig

Find <KEY_COMMON>
Here we map our physical Model
And map our new key as shown in fig.


Now we finished everything. Make sure that you compiled applet. Clear your browser cache.  And launch application and change your email. Hope everything works well.

Coding Physical Render(Part -3)




I have given three color for code. Red indicated that it is mandatory. Black indicates comment and green indicates custom code.

if( typeof( SiebelAppFacade.ValidatePR ) === "undefined" ){
    SiebelJS.Namespace( "SiebelAppFacade.ValidatePR" );
   
    SiebelApp.S_App.RegisterConstructorAgainstKey( "ValidatePRenderer", "SiebelAppFacade.ValidatePR" );
   
    SiebelAppFacade.ValidatePR = ( function(){
       
                               
        function ValidatePR( pm ){
            SiebelAppFacade.ValidatePR.superclass.constructor.call( this, pm );
            this.GetPM().AttachPMBinding( "isEmailSet",  validateEmail, { scope: this });
                /* This is very important. We bing �isEmailSet� variable. So that this will track changes in this variable in physical model. and if changes happed, then validateEmailwill execute. */
        }
       
        SiebelJS.Extend( ValidatePR, SiebelAppFacade.PhysicalRenderer );
       
                                 function validateEmail() {
                var controls = this.GetPM().Get( "GetControls" );
            var cntrl = controls[ "EmailAddress" ];        
/*The  controls[ "EmailAddress" ]; will return an object  that contain all information about EmailAddress*/
                                                var emailcntrl  = cntrl.GetInputName();
/*cntrl.GetInputName(); Using the above object getting input name  */
                                                var email = $('input[name="'+emailcntrl+'"]').val();
/*Here is jQuery!!... using our input name we are reading the value in it. */
                                                alert(email);
                                                var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
                                                if( !emailReg.test( email ) ) {
                                                                alert("Please enter a valid Email");
                                                                return false;
                                                } else {
                                                                alert("This is a valid Email");
                                                                return true;
                                                }
/*Using a regular expression, we are testing whether it is a valid email or not.. old browser script.. */
                                }
       
        return ValidatePR;
    }());
}

Now if you change value in email field, will trigger Physical Model.. then Physical render and email filed will get validated.  Hope you understand� :)

Coding Physical Render(Part -3)




I have given three color for code. Red indicated that it is mandatory. Black indicates comment and green indicates custom code.

if( typeof( SiebelAppFacade.ValidatePR ) === "undefined" ){
    SiebelJS.Namespace( "SiebelAppFacade.ValidatePR" );
   
    SiebelApp.S_App.RegisterConstructorAgainstKey( "ValidatePRenderer", "SiebelAppFacade.ValidatePR" );
   
    SiebelAppFacade.ValidatePR = ( function(){
       
                               
        function ValidatePR( pm ){
            SiebelAppFacade.ValidatePR.superclass.constructor.call( this, pm );
            this.GetPM().AttachPMBinding( "isEmailSet",  validateEmail, { scope: this });
                /* This is very important. We bing “isEmailSet” variable. So that this will track changes in this variable in physical model. and if changes happed, then validateEmailwill execute. */
        }
       
        SiebelJS.Extend( ValidatePR, SiebelAppFacade.PhysicalRenderer );
       
                                 function validateEmail() {
                var controls = this.GetPM().Get( "GetControls" );
            var cntrl = controls[ "EmailAddress" ];        
/*The  controls[ "EmailAddress" ]; will return an object  that contain all information about EmailAddress*/
                                                var emailcntrl  = cntrl.GetInputName();
/*cntrl.GetInputName(); Using the above object getting input name  */
                                                var email = $('input[name="'+emailcntrl+'"]').val();
/*Here is jQuery!!... using our input name we are reading the value in it. */
                                                alert(email);
                                                var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
                                                if( !emailReg.test( email ) ) {
                                                                alert("Please enter a valid Email");
                                                                return false;
                                                } else {
                                                                alert("This is a valid Email");
                                                                return true;
                                                }
/*Using a regular expression, we are testing whether it is a valid email or not.. old browser script.. */
                                }
       
        return ValidatePR;
    }());
}

Now if you change value in email field, will trigger Physical Model.. then Physical render and email filed will get validated.  Hope you understand… :)