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