knowledgecenter-breadcrum

Knowledge Center

31 May, 2022

How to create columns of different data types using Plugin

Posted on 31 May, 2022 by Admin, Posted in Dynamics 365 Dataverse Power Platform

How to create columns of different data types using Plugin Blogs

How to create columns of different data types using Plugin?

Introduction

In this blog, we will learn how to create text and integer type of fields using plugin.

We all know how we can create fields using entity customizations but not many of us know to do that using code.

Example

We will create a text field named Employee ID and integer field named Age on Employee entity  using Plugin.

  1. Create a Plugin with Execute method as below:

2. Add function named “CreateFieldsonEmployee” and add below code:

  • For creating Employee ID (text) field creation:

  • For Age (integer) field creation:

3. Build and register the plugin on Pre-Validation stage on create of Employee entity.

Result

  • Before fields creation:

 

 

  • After the fields creation:

 

Comment

This is a Required Field

Loading

Recent Updates

Thumbnail image
Blogs
13 Feb, 2025

Mastering Project Planning: How to Prevent Delays and Adapt to Any Challenge

Mastering Project Planning: How to Prevent Delays and Adapt to Any Challenge. Introduction Project delays are every project manager’s nightmare.…

READ MORE
Blogs
13 Feb, 2025

Filter List Using FetchXML in Power Pages

Introduction Power Pages provide a flexible way to display data using lists, but sometimes, you may need more advanced filtering than…

READ MORE
SMS_Thumbnail.jpg
Blogs
11 Feb, 2025

SMS Integration with Twilio Number in D365 Customer Service- Part 2

SMS Integration using Twilio Part 2 Introduction In Part 1, we covered below mentioned topics: Get Account SID and Auth…

READ MORE
  BENCHMARKS  
Loading Time: Base Classes  0.0008
Controller Execution Time ( Site / News Events Details )  0.2597
  GET DATA  
No GET data exists
  MEMORY USAGE  
8,273,176 bytes
  POST DATA  
No POST data exists
  URI STRING  
blog/how-to-create-columns-of-different-data-types-using-plugin
  CLASS/METHOD  
site/news_events_details
  DATABASE:  u450434725_nebulaa_live (Site:$db)   QUERIES: 14 (0.2432 seconds)  (Hide)
0.0349   SELECT `content_type`.*, `content_value`.*, `users`.*, `content`.*
FROM `content_value`
JOIN `contentON `content_value`.`content_id` = `content`.`content_id`
LEFT JOIN `usersON `content`.`created_by`=`users`.`user_id`
JOIN `content_typeON `content_type`.`content_type_id` = `content`.`content_type_id`
WHERE `content`.`url_title` = 'blog/how-to-create-columns-of-different-data-types-using-plugin'
AND `content`.`content_type_id` = 9
AND `content`.`content_published` = 1
AND (content.content_status is null or content.content_status='Approved')
AND 
content.deleted_at is null
AND content_type.deleted_at is null
GROUP BY 
`content`.`content_id`
ORDER BY `content`.`rank_orderDESC, `content`.`stick_ontopDESC 
0.0097   SELECT *
FROM `content_value`
WHERE `content_idIN('473')
ORDER BY `content_value_rankAS
0.0206   SELECT `content_type`.*, `content_value`.*, `users`.*, `content`.*
FROM `content_value`
JOIN `contentON `content_value`.`content_id` = `content`.`content_id`
LEFT JOIN `usersON `content`.`created_by`=`users`.`user_id`
JOIN `content_typeON `content_type`.`content_type_id` = `content`.`content_type_id`
WHERE `content`.`content_idNOT IN('473')
AND `
content`.`content_published` = 1
AND `content`.`content_type_id` = 9
AND (content.content_status is null or content.content_status='Approved')
AND 
content_value.field_machine_name="date_9"
AND content.deleted_at is null
AND content_type.deleted_at is null
GROUP BY 
`content`.`content_id`
ORDER BY STR_TO_DATE(content_value.content_value"%d-%m-%Y") DESC, `content`.`rank_orderDESC, `content`.`stick_ontopDESC
 LIMIT 3 
0.0107   SELECT *
FROM `content_value`
WHERE `content_idIN('4657''4646''4655')
ORDER BY `content_value_rankAS
0.0532   SELECT `content_type`.*, `content_value`.*, `users`.*, `content`.*
FROM `content_value`
JOIN `contentON `content_value`.`content_id` = `content`.`content_id`
LEFT JOIN `usersON `content`.`created_by`=`users`.`user_id`
JOIN `content_typeON `content_type`.`content_type_id` = `content`.`content_type_id`
WHERE `content`.`content_published` = 1
AND `content`.`content_type_id` = 13
AND (content.content_status is null or content.content_status='Approved')
AND 
content.deleted_at is null
AND content_type.deleted_at is null
GROUP BY 
`content`.`content_id`
ORDER BY `content`.`rank_orderDESC, `content`.`stick_ontopDESC 
0.0145   SELECT *
FROM `content_value`
WHERE `content_idIN('4650''4649''4549''4483''4372''546''530''523''514''509''497''472''465''463''462''195''194''191''188''186''185''183''777''100''99''98''97''96''95''94')
ORDER BY `content_value_rankAS
0.0483   SELECT `content_type`.*, `content_value`.*, `users`.*, `content`.*
FROM `content_value`
JOIN `contentON `content_value`.`content_id` = `content`.`content_id`
LEFT JOIN `usersON `content`.`created_by`=`users`.`user_id`
JOIN `content_typeON `content_type`.`content_type_id` = `content`.`content_type_id`
WHERE `content`.`content_published` = 1
AND `content`.`content_type_id` = 9
AND (content.content_status is null or content.content_status='Approved')
AND 
content.deleted_at is null
AND content_type.deleted_at is null
GROUP BY 
`content`.`content_id`
ORDER BY `content`.`rank_orderDESC, `content`.`stick_ontopDESC 
0.0337   SELECT *
FROM `content_value`
WHERE `content_idIN('4657''4655''4653''4651''4646''4610''4601''4591''4571''4556''4550''4538''4510''4503''4484''4447''4446''4445''4444''4410''4402''4393''4389''4388''4387''4384''4373''4359''4356''4354''4349''941''939''926''924''919''918''917''916''912''911''900''802''798''792''791''786''784''782''774''772''769''767''460''461''235''464''466''184''187''190''189''192''193''196''197''198''199''200''569''467''201''468''469''202''203''470''204''205''206''471''473''475''476''477''478''479''480''481''482''483''484''485''486''487''494''495''496''498''499''500''501''502''503''504''505''506''507''508''510''511''512''513''515''516''517''518''519''520''521''522''524''525''549''526''550''527''551''528''552''529''553''531''537''554''559''532''538''560''539''555''561''533''541''562''542''556''568''534''543''563''544''557''564''535''545''565''547''558''566''536''548''567')
ORDER BY `content_value_rankAS
0.0026   SELECT `comment`.*, `customer`.`name`, `reply_comment`.`reply_id`, `customer`.`profile_pic`
FROM `comment`
INNER JOIN `content_commentON `content_comment`.`comment_id`=`comment`.`comment_id`
INNER JOIN `customerON `customer`.`customer_id`=`comment`.`user_id`
INNER JOIN `reply_commentON `reply_comment`.`comment_id`=`comment`.`comment_id`
WHERE `comment`.`comment_status` = 'active'
AND `content_comment`.`content_id` = '473'
AND `reply_comment`.`parent` = 'NULL'
ORDER BY `comment`.`created_atDESC
 LIMIT 5 
0.0007   SELECT *
FROM `menu_link`
LEFT JOIN `mediaON `media`.`media_id`=`menu_link`.`icon_image`
WHERE `menu_master_id` = 1
AND `link_status` = 1
AND menu_link.deleted_at is null
ORDER BY 
`link_weight
0.0002   SELECT *
FROM `menu_link`
LEFT JOIN `mediaON `media`.`media_id`=`menu_link`.`icon_image`
WHERE `menu_master_id` = 2
AND `link_status` = 1
AND menu_link.deleted_at is null
ORDER BY 
`link_weight
0.0005   SELECT *
FROM `menu_link`
LEFT JOIN `mediaON `media`.`media_id`=`menu_link`.`icon_image`
WHERE `menu_master_id` = 1
AND `link_status` = 1
AND menu_link.deleted_at is null
ORDER BY 
`link_weight
0.0032   SELECT `content_type`.*, `users`.*, `content`.*
FROM `content`
JOIN `content_typeON `content_type`.`content_type_id`=`content`.`content_type_id`
LEFT JOIN `usersON `content`.`created_by`=`users`.`user_id`
WHERE `content`.`content_type_id` = 14
AND `content`.`content_published` = 1
AND `content`.`deleted_atIS NULL
AND (content.content_status is null or content.content_status='Approved')
AND 
content.deleted_at is null
AND `content`.`parent_content_id` = '0'
AND content_type.deleted_at is null
ORDER BY 
`content`.`stick_ontopDESC, `content`.`rank_orderDESC, `content`.`content_idDESC 
0.0105   SELECT *
FROM `content_value`
WHERE `content_idIN('107')
ORDER BY `content_value_rankAS
  HTTP HEADERS  (Show)
  SESSION DATA  (Show)
  CONFIG VARIABLES  (Show)
Debugger