Как получить встроенный CSS элемента управления PCF в форме D365?CSS

Разбираемся в CSS
Ответить
Anonymous
 Как получить встроенный CSS элемента управления PCF в форме D365?

Сообщение Anonymous »

У меня есть элемент управления PCF в форме в Dynamics 365. Я хочу получить встроенный CSS этого элемента управления PCF при событии сохранения формы. До сих пор я пробовал этот код, чтобы получить CSS, но он всегда попадает в первый оператор else и печатает «Элемент управления не найден».:
var control = formContext.getControl("myControlName"); //I am copying the control name from the data-id tag
if (control) {

var controlElement = document.querySelector(`[data-id='${control.getName()}-field']`);
if (!controlElement) {
console.log("Attempting to locate DOM using parent container..."); // Log the surrounding HTML for debugging
//console.log("Outer HTML:", document.body.);
const myDiv = document.getElementById('inputField');
const style = window.getComputedStyle(myDiv);
console.log(style.border);
}
if (controlElement) {
// Retrieve the computed styles
var computedStyle = window.getComputedStyle(controlElement);

// Example: Get specific CSS properties
console.log("Background color:", computedStyle.backgroundColor);
console.log("Font size:", computedStyle.fontSize);
console.log("Width:", computedStyle.width);
console.log("Height:", computedStyle.height);
} else {
console.log("Control DOM element not found.");
}
} else {
console.log("Control not found.");
}


Подробнее здесь: https://stackoverflow.com/questions/793 ... -d365-form
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «CSS»