Transfer order receive codeunit

I want to run a function when transfer order receive Boolean OK is clicked.
whenever the user click ok of receive Boolean ,then the function will check the condition if the condition it meets for that user by running the function defined,if is ok then receive will work else it will show an error message.

Please help me where i have to write and call the function on transfer order codeunit

b42qwbkxbzxt.jpg
here is my function calling


IF NOT CheckLocationUser(user,"Transfer-to Code") THEN
ERROR('You are not allowed to Recieve beyond Your Location');

Comments

  • da_nealda_neal Member Posts: 76
    edited 2019-09-12
    5705 TransferOrder-Post Receipt (OnRun)
  • jhoomnewidjhoomnewid Member Posts: 3
    @da_neal I have written the the code on 5705 under "Onrun.But it is not working....
    in both cases it is showing the message.,ie, if user and transfer to location matches and if does not match...for both it is showing the defined error message.
    I have allocated transfer to location for each user in "mylocations" table.
    Now at time of recive if current logged in user trying too recieve the order beyond his allocated location, then the error message will spark.But in my casemessage is showing whether use and transfer to location matches or not with mylocation table...

    3otm4kf8a3yy.jpg

    this is where i defined the locations against the user

    2n7tvjm1w4bw.jpg
    nrhg73hd5rp9.jpg


    Code and function "on run" of 5705 codeunit

    aqd40zvq186v.jpg
    16dvtfnxt0ln.jpg
    eajpr31se9pc.jpg

    additional info....

    plz help
  • da_nealda_neal Member Posts: 76
    hm... Where in your function filter to User?
    hyqng6h2ksj3.png
  • jhoomnewidjhoomnewid Member Posts: 3
    @da_neal yaa....u r right...

    I have written the same function for "transfer from code" in transfer header....
    as below
    Transfer-from Code - OnValidate()

    user := USERID;
    //MESSAGE(Text008, USERID);
    IF NOT CheckLocationUser(user,"Transfer-from Code") THEN
    ERROR('You are not allowed to Ship/Recieve beyond Your Location');

    will the same work here in 5705?
  • da_nealda_neal Member Posts: 76
    blsuwbsykjit.png

    advice one: name parameter not same as field, in your function best to name TransferToCode, not
    "Transfer-to Code".
    advice two: check which variable you use. TransferHeader is a global variable not initialized yet in your sequence code.
Sign In or Register to comment.