Search the FirstSpirit Knowledge Base
Since i created one variable ssManualMandant under the Site store , i wrote a script that scan the site store variables and check the ssManualMandant
exist or not My Motive is to check the variable ssManualMandant variable exist or not i dot need what value ssManualMandant contains.
siteStoreRoot=context.getProject().getUserService().getStore(Type.SITESTORE,true);
JOptionPane.showMessageDialog(null,siteStoreRoot().getFormData().get(context.getProject().getMasterLanguage(),"ssGlobalSettings").getName());
result is coming ssGlobalSettings
and
JOptionPane.showMessageDialog(null,siteStoreRoot().getFormData().get(context.getProject().getMasterLanguage(),"ssGlobalSettings").getName().isEmpty());
in this case result is false .
i created one variable ssManualMandant in site store and in this script in place of ssGlobalSettings i wrote ssManualMandant and result is coming
ssManualMandant
false
my requirement is in some project i set ssManualMandant so its check ssManualMandant variable exist or not is site store variable if not so produce false value
In my case if i have not set ssManualMandant variable in SiteStore and i will write the script to check ssManualMandand exist or not so in this case i am getting error NoSuchFormFieldException ssManualMandant
so i want a script that shows the false value if the ssManualMandator variable not created.
Please check the attachement
Example link was a link to FirstSpirit 4.2 API. The example in FirstSpirit 5.0 API is linked here:
http://www.e-spirit.com/odfs50/access/?examples/de/espirit/firstspirit/access/store/sitestore/SiteSt...
Here you can find an example for modifying sitestore variables:
In your specific problem I would use the GomEditorProvider and .findEditor() like that:
siteStoreRoot = context.getProject().getUserService().getStore(Store.Type.SITESTORE,true);
gomFormProvider = siteStoreRoot.getFormData().getForm();
formField = gomFormProvider.findEditor("ssManualMandator");
If ssManualMandator exists your return will be a GomFormElement. Otherwise it will return null. You can test it like that:
siteStoreRoot = context.getProject().getUserService().getStore(Store.Type.SITESTORE,true);
gomFormProvider = siteStoreRoot.getFormData().getForm();
if (gomFormProvider.findEditor("ssManualMandator") != null) {
return true;
} else {
return false;
}
Hope that will do for your skript.
Example link was a link to FirstSpirit 4.2 API. The example in FirstSpirit 5.0 API is linked here:
http://www.e-spirit.com/odfs50/access/?examples/de/espirit/firstspirit/access/store/sitestore/SiteSt...
Hello,
do you need further help or did Carola's reply already help you? If so, it would be great if you marked
her reply as "correct answer" so that other community users find the solution easily. If you have
already found a solution by yourself, it would be very kind of you, if you posted it here.
Best regards
Michaela