Service portal

srilakshmikanth
Tera Contributor

I need to create a custom widget for importing the bulk data into service portal , as I am new to service portal let me know how to solve this

Thanks 

Lakshmi

5 REPLIES 5

AnveshKumar M
Tera Sage
Tera Sage

Hi @srilakshmikanth 

What type of data you want to import? And what is the Target table? Who will upload the data (role or user who can upload the data)? Whether they upload any file like Excel?

 

Thanks,
Anvesh

Excel file data want to be upload

Any tagret table 

User want to be upload

Only Excel file need to be import

@srilakshmikanth It would be little complex to build this from scratch. You can refer the following article for quick start.

 

https://www.servicenow.com/community/developer-articles/parsing-the-excel-sheet-data-use-the-data-in...

 

Thanks,
Anvesh

Amit Gujarathi
Giga Sage
Giga Sage

HI @srilakshmikanth ,
I trust you are doing great.

1. Understand the Requirements

  • Data Format: Determine the format of the data to be imported (e.g., CSV, Excel).
  • Data Destination: Identify the ServiceNow table where the data will be imported.

2. Set Up the Service Portal Widget

  • Create the Widget: In ServiceNow, navigate to Service Portal > Widgets and create a new widget.
  • Widget Basics: Give your widget a name and a description that reflects its purpose.

3. Design the Widget's Front-End

  • HTML Structure: Design the HTML to include a file upload input.
  • Client Script: Use AngularJS for client-side scripting to handle the file upload event.

SAmple HTML code :

<div class="file-upload">
    <input type="file" id="fileInput" ng-model="data.file" accept=".csv"/>
    <button ng-click="c.upload()">Upload</button>
</div>

Sample Client Script

function($scope, spUtil) {
    $scope.upload = function() {
        var fileInput = document.getElementById('fileInput');
        var file = fileInput.files[0];
        // Further processing of file
    };
}

 

Sample Server Script

api.controller = function() {
    /* widget controller */
    var c = this;

    // Define the method to handle file processing
    c.processFile = function(fileData) {
        // Parse fileData and insert into a ServiceNow table
        // Use GlideRecord for database operations
    };
};

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi