See the article titled Using Local Scripts with an External Data Set in Junos Space Resources. This article will show you how to pull information from an external data set (XML file) to be used in a local (commit) script to configure devices that might or might not have unique configuration needs.