Hello All,
There have been certain requirement that makes us write repetitive code, like sending email or SMS where we need to write either a function or script each time we need to call the code. Can there be some better way of handling this type of repetitive code?
Application Level functions are the solution to these type of requirement. Consider one more case we use LookupValue functions to fetch LOV value that gives us either Name or Display Value. In case when length is more then 30 we need to call custom code.
Here we can make a Application level function say LookupDesc that returns Description and can be call by TheApplication() method.
See sample code for the same
//Your public declarations go here... function LookUpDesc(Type,Value) { try { var sDesc = ""; var boLOV = TheApplication().GetBusObject("List Of Values"); var bcLOV = boLOV.GetBusComp("List Of Values"); with (bcLOV) { ClearToQuery(); SetViewMode(AllView); ActivateField("Description"); SetSearchSpec("Type", Type); SetSearchSpec("Value", Value); ExecuteQuery(ForwardOnly); if (FirstRecord()) { sDesc = GetFieldValue("Description"); } } //with return(sDesc); } catch(e) { throw(e); } finally { bcLOV = null; boLOV = null; } } |
No comments:
Post a Comment