Question

I'm working with Siebel 7.8. I've a requeriment to make a field read only based on a condition, but only for certain applets.

These are some options that I've already discarded:

  • Applet user property Read Only Field n: this would be the ideal way to do it, but I'm afraid it's only available in Siebel 8.x. Apparently, Siebel 7.8 only supports it if the applet class is CSSFrameListQuoteItem, which is not my case. (Please, correct me if I'm wrong here - I didn't found any official info on this user property, neither in the bookshelf nor the support web).

  • BC user property Field Read Only Field: it would make the field read only everywhere, which is not acceptable. I know I could make a copy of the buscomp, add the user property, and use it in my applets, but I really really really don't want to clone it.

  • BC user property Field Read Only Field, depending on the active view: Ok, this one could work. I'd add a calculated field with a expression like IIf([MyConditionsForReadOnly]='Y' AND GetProfileAttr('ActiveViewName')='MyView', "Y", "N"), and use it as read only flag. However, the list of views where my applets are present is quite long... I could forget to add one of these wiews. Furthermore, we should remember to update the calculated field each time we add a new view including one of these applets - not very practical, isn't it?

  • Server scripting. I could just cancel the operation on PreSetFieldValue, but once again, I should do it based on the active view name, not the applet's name. (Can I retrieve the name of the applet from which a BC event was fired? I believe it's not possible...)

  • Browser scripting, at applet's control level maybe? No thank you...

And I'm fresh out of ideas. Am I missing something? Is there a clean way to implement this requeriment?

Was it helpful?

Solution 2

I finally managed to do it, without messing too much the application.

I was wrong about one of my assuptions: you can retrieve the name of the active applet in scripting... it just can't be done with server scripts, but it's possible with browser scripts.

This is the piece of code that I put on my buscomp browser script:

function BusComp_PreSetFieldValue (fieldName, value)
{
    // ...
    var currentApplet = TheApplication().ActiveApplet().Name();
    if ((fieldName == "MyField") && (currentApplet == "MyApplet1") && otherConditions) {
        alert("You can't do that!");
        return "CancelOperation";
    }

    return "ContinueOperation";
}

It works perfectly. I would prefer an applet-based solution instead of placing my code in the BC, but at least it doesn't depend on the view.

OTHER TIPS

I see you have decided to pop-up an error, instead of turning the field read-only.

Wanted to share something I did years ago to make a field read only, not sure if it is best solution. You could use toggle applets.

You could have two applets, one where the field is read only, and one where it is editable. And then use the condition to toggle between them. The field will be read only , no scripting required.

Another option, if your applets are form applets, you could you browser scripting to turn the field read only.

Use FindControl or FindActiveControl and use .readOnly=true

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top