Closing a Parent form from a Child form

manjusreemanjusree Member Posts: 79
Hi all,

How can we close the parent form from a child form?..I want to change the status of the parent form from 'Released' to 'Finished' just after posting the child form. All the routine works fine, but the problem comes while i close the child form. The system tries to find out the 'Released' parent record which no longer exists and so it displays error.

Any knid of help would be apreciated.

Cheers,
Manjusree

Comments

  • garakgarak Member Posts: 3,263
    after posting the rec from the "child" window, you delete also the rec from the parent window :?:
    Do you make it right, it works too!
  • manjusreemanjusree Member Posts: 79
    Thanx for ur reply. But I don't want the Parent rec got deleted. Instead its status should be changed from 'Released' to 'Finished'. Is this possible?

    Cheers,
    Manjusree
  • SogSog Member Posts: 1,023
    After the child form is booked call a function from the child in the parent window which has the purpose of closing the window.
    You'll have to write the function yourself. If this does not work you could always put a different filter on the parent record.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • garakgarak Member Posts: 3,263
    search the forum for CLOSe Form
    Do you make it right, it works too!
  • manjusreemanjusree Member Posts: 79
    Hi all,

    Thx for the replies. When I delete the Parent Rec, it works quite fine. But if i try to change the Parent rec status instead of deleting it, the error comes. I don't think that Timer method/single instance code unit method will do something since i'm not using RUNMODAL to open the Child form.

    The status of Parent while opening the Child is 'Released' and after posting the Child, Parent's status should be 'Finished'. Is there any method to exit the child without going back searching for the 'Released' parent???

    Regards,
    Manjusree
  • matttraxmatttrax Member Posts: 2,309
    Do you have a filter on the status? If so when NAV goes back to try to get the record from the database to modify it it won't be able to find it because it has been changed.

    It will also mess up things like NEXT because the last record is no longer in the database.
  • BeliasBelias Member Posts: 2,998
    just an idea:
    what if you put a
    FILTERGROUP(4);
    SETFILTER(STATUS,'%1|%2',STATUS::RELEASED,STATUS::FINISHED);
    FILTERGROUP(0);
    
    before your posting routine?I think this should avoid the subformlink property.
    I've never tried this, but i'm really curious to see if it works.
    N.B.: You must use filtergroup No. 4: see the online help for more info, if you don't know why :wink:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • manjusreemanjusree Member Posts: 79
    Thanking u all..Currently the parent form is filtered by status 'Released'. Is it that with FILTERGROUP(4) and subsequent filtering code, we can replace the default filter with "Released|Finished"?. I've tried using Filtergroups..but i'm afraid, still the error comes :oops:
  • BeliasBelias Member Posts: 2,998
    ok, then the "released" is not in the subformlink property of the subform, but it is a subformview in the header...
    in this case, my code is useless #-o
    then, where is the code that updates the status of the parent rec?(under a button, within a function...)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • manjusreemanjusree Member Posts: 79
    yeah, you are right.. 'Released' is the 'SourceTableView' property of parent header. Parent's status should change on the button click of the child. I've written both the posting of child and change status of parent in 'OnPush' trigger of child's Post button.
  • BeliasBelias Member Posts: 2,998
    the button of the child form? :-k
    can you post a screenshot of your form please?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • manjusreemanjusree Member Posts: 79
    Actually I'm using Production order and Pick form. In this particular customization, I want the Production order status should be changed from Released to Finished on registering the Pick. I have written the code in "OnPush" trigger of Warehouse Pick->Register button.
  • BeliasBelias Member Posts: 2,998
    then we're not talking about a form + subform like a sales invoice (where subform is the "sales lines" form), isn't it?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • manjusreemanjusree Member Posts: 79
    The real scenario is I have a 'Released' Production Order form as Parent. we can create Pick in the usual way and then we have Put-away/Pick lines->card. When i say child I mean this Pick form. Actual requirement is that on registering the Pick, the Production order status should change from Released to Finished. The error comes after posting, when we escape from 'Warehouse Pick Lines' form. Please find the screenshot attached.

    Is there any method by which we can just skip from the Pick form so that the system won't go back searching the Prod. order?

    Thanx
  • BeliasBelias Member Posts: 2,998
    ok, now it's clear!
    I can imagine these 2 methods:
    a) the simpler, is to change the subformview of the released production order form, from released to released|finished
    b) create a new form (a copy of released production order), with subformview released|finished: this is better than 1.a because you don't modify standard behaviour
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • manjusreemanjusree Member Posts: 79
    Thats the problem :( . I can't change it. I want only the Released orders there.
  • BeliasBelias Member Posts: 2,998
    oh... :-k
    try to change with SaveTableView and SourceTablePlacement properties

    EDIT: i don't think it will work...instead, a simple solution came in my mind: why don't you "finish" the order the order after closing the pick form?i mean: you post, you close the form, you get back to production order form and then you "finish" it!
    in this way, the record will go out of scope and "disappear" from the form, moving the user to the next one
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • manjusreemanjusree Member Posts: 79
    edited 2009-07-15
    Initially it was implemented like that. This one is a new reuirement since some users leave the form without changing the status to finished. So I just wanted to know if both can be done at a stretch.

    Belias, thanx a lot for ur help.
  • BeliasBelias Member Posts: 2,998
    i mean to change the status automatically, but after closing the form:
    - use a single instance codeunit: here you have a function where you store the an array of no. of the orders to "finish" just after the pick posting.
    when you get back to the production order form (or when you close it) you retrieve the no. or numbers from the SI codeunit and you "finish" them. after that, be sure to clear the values in the SI codeunit
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.