Hello Dojo,
We created a new field on Jobs. How can we make the Dataminer read that field and show it on Jobs and Booking Managers?
Regards,
Yohan
Hi Yohan,
This new Job field will be new metadata to be added to your booking. This can be achieved by adding a new custom booking property to your bookings. Then, you need to update the code that is converting Jobs to Bookings to read the value from the Job field and add it to the booking property.
How to implement this:
- Go to BOOKING MANAGER > CONFIG tab.
- Enable Custom properties.
- Right-click in the table and select 'Add property...'
4. Fill in Property fields
5. Update automation script that converts Jobs to Bookings to read the Job field value
SectionDefinition generalDef = _jobHelper.SectionDefinitions.Read(SectionDefinitionExposers.ID.Equal(defaultSectionDefinitionExtension)).First();
string servDefJobFieldValue = job.GetFieldValue<string>(generalDef, generalDef.GetFieldDescriptorById(new FieldDescriptorID(jobFieldGuid))).Value;
6. Update automation script that converts Jobs to Bookings to include the Job field value as property value.
// Selecting properties - PLEASE USE VISUAL STUDIO TO SEE ALL OPTIONSvarproperties = newList<Property>();
varproperty = bookingManager.Properties.FirstOrDefault(x =>
string.Equals(x.Name, "WO", StringComparison.InvariantCultureIgnoreCase));if(property != null)
{
property.Value = servDefJobFieldValue ;
property.IsChecked = true;
properties.Add(property);
}// Safe method, won't throw exceptions, though in case of error cannot be seen
var success = bookingManager.TryCreateNewBooking(engine, bookingData,
functions, customEvents, properties, null, out ReservationInstance reservation);
After this, you should be able to see the booking properties in your Bookings list. Do note by default the booking properties are hidden but you can enable them by right-clicking the columns in the list and show the property:
You can also check more details from the code snippets from above on this link: DataMiner Docs
Did you create the field with the Jobs app? If that's the case, the fields should be available for new and old jobs of that domain.
Creating a new field in the app can be done like this:
This field will then be available on jobs for that job domain:
There are some scenario's where the field might not be visible in the UI though.
This will be the case when a field or section is marked as hidden. This will be the case when a field/section was deleted while there were still jobs that used the field/section:
Anothing thing to consider is that the fields will not be displayed in the list when the setting "Show in list view" on the field is disabled.
Something else to be aware of is that the section definitions are being cached in the app. So having the jobs app open (either embedded in a Cube or in your browser) will not show new or updated fields that were created in the background. A page refresh is required for those changes to be taken into account.