is it passible to validate field value through Navision web service before insert or update

vinceliu666vinceliu666 Member Posts: 51
Hi All:

Navision provide web service that you could call it for insert , update ... etc. The filed value will be validated when you call web service Create / Update function. But I just want to validate field value before call Create / Update function for checking filed value legally .

Is it passible to validate field value through Navision web service before insert or update? Does anyone has ideal to do it ?

Best Answers

  • vinceliu666vinceliu666 Member Posts: 51
    Answer ✓
    Tony_NCD wrote: »
    Just copy the validation from where it currently exist, create something similar in the web service and utilize it before the create/update function in the web service. This, of course, means it will be inefficient since it's having to do the same thing twice but it does what you're asking. You can get around the inefficiency but you have to ask yourself how often it happens and whether it's worth it with a little more programming.

    Thanks for your feedback , My Issue is that if I run record.insert, the record will be inserted. But I just want to validate data only, not insert record. If I run the record.insert , I must delete the record after insert . But the autoasign no for example Sales Order No will be add one.
  • irasoelbaksirasoelbaks Member Posts: 119
    Answer ✓
    Tony_NCD wrote: »
    Just copy the validation from where it currently exist, create something similar in the web service and utilize it before the create/update function in the web service. This, of course, means it will be inefficient since it's having to do the same thing twice but it does what you're asking. You can get around the inefficiency but you have to ask yourself how often it happens and whether it's worth it with a little more programming.

    Thanks for your feedback , My Issue is that if I run record.insert, the record will be inserted. But I just want to validate data only, not insert record. If I run the record.insert , I must delete the record after insert . But the autoasign no for example Sales Order No will be add one.

    Another option is to make a Record Variable: Temporary. By using Temp Tables you can do all CRUD operations without committing anything to your Physical table.

Answers

  • foo_barfoo_bar Member Posts: 91
    you can validate the field in the OnInsert trigger
  • irasoelbaksirasoelbaks Member Posts: 119
    If you want to validate the field on certain criteria, value or pattern just write a function and publish it as a Soap Service for example and test the value with your own logic. After validation perform a Rec.Insert(TRUE) or Rec.Modify(TRUE) for example.
  • vinceliu666vinceliu666 Member Posts: 51
    Answer ✓
    Tony_NCD wrote: »
    Just copy the validation from where it currently exist, create something similar in the web service and utilize it before the create/update function in the web service. This, of course, means it will be inefficient since it's having to do the same thing twice but it does what you're asking. You can get around the inefficiency but you have to ask yourself how often it happens and whether it's worth it with a little more programming.

    Thanks for your feedback , My Issue is that if I run record.insert, the record will be inserted. But I just want to validate data only, not insert record. If I run the record.insert , I must delete the record after insert . But the autoasign no for example Sales Order No will be add one.
  • Wisa123Wisa123 Member Posts: 308
    There is no simulate OnInsert, OnModify, OnValidate triggers without actually calling them first.
    The only way around that would be to implement your own AL function that does the wished validation for you - without actually inserting - which honestly sounds like a nightmare to code and maintain for complex scenarios.
    Austrian NAV/BC Dev
  • irasoelbaksirasoelbaks Member Posts: 119
    Answer ✓
    Tony_NCD wrote: »
    Just copy the validation from where it currently exist, create something similar in the web service and utilize it before the create/update function in the web service. This, of course, means it will be inefficient since it's having to do the same thing twice but it does what you're asking. You can get around the inefficiency but you have to ask yourself how often it happens and whether it's worth it with a little more programming.

    Thanks for your feedback , My Issue is that if I run record.insert, the record will be inserted. But I just want to validate data only, not insert record. If I run the record.insert , I must delete the record after insert . But the autoasign no for example Sales Order No will be add one.

    Another option is to make a Record Variable: Temporary. By using Temp Tables you can do all CRUD operations without committing anything to your Physical table.
  • vinceliu666vinceliu666 Member Posts: 51
    irasoelbaks:

    It seems work. I thought your suggestion is the best solution. I could validate field value and not really insert or update the record in physical table. thanks for your answer.
Sign In or Register to comment.