AnsweredAssumed Answered

Getting PK1 of course in a building block

Question asked by dave.sharples on Sep 4, 2017
Latest reply on Sep 17, 2017 by dave.sharples

Hi, I am trying to modify an old building block to get the pk1 of a course and then use that to put in a URL

 

Currently we have something like this

 

if(bbContext.hasCourseContext()){

  

    String course_id  = bbContext.getCourse().getCourseId();

    String course_sub = course_id.substring(6);

 

and then using that value like this

 

<p><a href="http://www.externallink.com?sv<%=course_sub %>" target="_blank">

 

What I need to do is change using the course ID to using the pk1 value, but my lack of knowledge of the api's / developing is showing here. Can I quickly get the current pk1 of the course we are in and swap it over?

 

This is in Q2 2017, self hosted

 

Thanks

Outcomes