0 votes

Has anyone already made a custom to open for example the search window for products from a Opportunity with a specific custom view selected (always)?

asked in Efficy/ Client side by (618 points)

2 Answers

0 votes

Hello Stijn.

Use the same technique as desribed in this post. Init the ACC_OPTIONS property at logon using database workfow.

https://overflow.efficy.com/?qa=795/how-to-set-specific-search-method-at-load-in-the-search-popup&show=798#a798

I used it in larger projects with success. During a session, the setting can be changed, but as soon as the user logs on again, it resets to what you have defined in the database workflow

Greetings
Kristof

answered by (7.4k points)
Specific per entity / button?
In general this is possible, but I need more specific customs

like :

From Company edit > link product > custom view X activated in Search product window

From Oppo edit > behind custom button A > custom view Y activated in Search product window

From Oppo edit > behind custom button B > custom view Z activated in Search product window
Provide the &queryview=123 as an argument to the URL of the search request.
That should work, not?
0 votes

I added a default queryview feature in Efficy by adding some workflow script

point is that you just have to create a queryview everywhere you want with the name containing (*) example : "Details (*)"

those views will automatically become default after every logon.
WARNING : I havn't managed to check if user are linked to the queryview or the multiple queryviews with (*) so override my code or just give security to every users.

in the workflow add this :

function AfterLogon(){
    initUserOptions();
}

then

function initUserOptions(){

    var 
        qh = 0,
        tc = Database.OpenTemporaryContext(),
        sql = "";

    sql += "select ";
    sql += "    V.K_QUERYVIEW, ";
    sql += "    (select E.NAME from admin.SYS_ENTITIES E where E.K_ENTITY = V.K_MASTER) as MASTER_NAME, ";
    sql += "    (select E.NAME from admin.SYS_ENTITIES E where E.K_ENTITY = V.K_DETAIL) as DETAIL_NAME, ";
    sql += "    (case V.K_DETAIL when -1 then 'Search' else 'Consult' end) as CONTEXT "; 
    sql += "from admin.QUERYVIEWS V ";
    sql += "where V.NAME like '%(*)%' ";

    var ds = Database.ExecuteSystemSQLQuery(qh, tc, sql, "", true, false, 1);
    ds.First();

    while (!ds.EoF){
        var 
            context = ds.FieldByName("CONTEXT").AsString,
            master = ds.FieldByName("MASTER_NAME").AsString,
            detail = ds.FieldByName("DETAIL_NAME").AsString,
            key = ds.FieldByName("K_QUERYVIEW").AsString;

        var section = context + master + "_";
        section += (context == "Consult")? detail + "_": "";
        section += "QueryView";

        Database.WriteString("Efficy", section, key);

        ds.Next();
    }
}
answered by (989 points)
1,248 questions
1,517 answers
1,858 comments
328 users