How can perform a bulk record deletion in a zoho creator app?
Hello,
I am Developing a solution and i am trying to create a function that will delete all records in all forms in the application.
here is what i've been able to come up with:
- string AppConfig.clearAllAppData()
- {
- /**********************************Log variable declaration**************************************/
- fullLog = "";
- name = "";
- recCounts = "";
- deleted = false ;
- /**********************************END-Log variable declaration**************************************/
-
- /*************************CONST VARIABLES*********************************/
- format = "xml";
- applicationName = zoho.appname;
- appuri = zoho.appuri;
- authToken = "3bd****************************8b";
- /*************************END-CONST VARIABLES*********************************/
-
- /*************************OBJECT TO BE PASSED HTML GET FUNCTION*****************************/
- endPoint = "https://creator.zoho.com/api/"+format+"/"+applicationName+"/forms";
- params = Map();
- params.put("authtoken", authToken);
- params.put("scope", "creatorapi");
- params.put("zc_ownername", zoho.adminuser);
- /*************************END-OBJECT TO BE PASSED HTML GET FUNCTION*****************************/
- appForms = invokeUrl
- [
- url : endPoint
- type : GET
- parameters : params
- ];
- formsCount = appForms.executeXPath("response/application[@name='chservicesalesmgt1-ide']/formlist/formcount/text()");
- formLinkNames = appForms.executeXPath("response/application[@name='chservicesalesmgt1-ide']/formlist/form/componentname/text()");
- formLinkNamesList = formLinkNames.toList("-|-");
-
- for each _form in formLinkNamesList
- {
- delete from _form [ ID != null ];
- // if ( _form[ID != null].count() == 0 )
- // {
- // fullLog = fullLog + ", "+form ;
- // delete from _form [ ID != null ];
- // }
- }
-
- return "Application data has been deleted successfully";
- }
however, it seem i cannot reference form link name through the variable "_form" that holds the form_link_name.
here is the error i get when i try to save it:
Here is error when trying to save the codeCan anyone please suggest a work around to it for me?
Thanks!